Questions and Answers

How do I collect points?

  • +4
    Chosen as best answer
  • +1
    Posted answer
  • +1
    Posted question
  • +1
    Thumb up
  • -1
    Thumb down
4

by smiley in Coding about October 26, 2012 closed - report

Show just on Home Page

Hi, 

 

I would like to place a widget in the header, and to show part of it's content just on the Home Page (NOT Member Home Page).

Is there anything I can use, like:

if($this->index()) {

  //do just on the Home Page

} else { 

  //do something else

}

 

Thanks

Answers: 3  •  Score 0  •  Views: 922

3 Answers
Browse by
  • 264

    by Gaurav Sharma about October 27, 2012 Best answer

    <?php if($this->viewer ==null  && $this->viewer->getIdentity() == 0): ?>


    plz try only this condition

    • Score: 0
    1 comment
    • smiley
      by smiley
      October 28, 2012

      Thank you!

  • 264

    by Gaurav Sharma about October 27, 2012

    you can also write 

     

    public function init()
    {
    !$this->_helper->requireUser();

    }

     

    in widget controller

     

    before index action

    • Score: 0
  • 264

    by Gaurav Sharma about October 26, 2012

    <?php if($this->viewer ==null  && $this->viewer->getIdentity() == 0 && $this->viewer->getIdentity() == $this->subject()->getIdentity()) { ?>

     

     

    for home page

     

    get the viewer

     

     $this->view->viewer=$viewer = Engine_Api::_()->user()->getViewer();

    2 comments
    • smiley
      by smiley
      October 26, 2012

      Actually this affects all pages when the user is not logged in. I need something to make it happen only on the visitor's Home Page.

    • smiley
      by smiley
      October 27, 2012

      Any idea? Thanks.

Question was closed.