View Full Version : show only on home page
solutionsphp
08-28-2005, 02:31 AM
Hello--
I'm using the following code in footer.tpl to show something only on the home page:
Content visible to registered users only.
I am interested in applying this to an area within main.tpl as well, to execute some PHP code IF the page is the home page:
Content visible to registered users only.
However, this produces the most unexpected results. At first glance, there are no problems, but then if I refreshed the page, the main content area in the template became populated with the whole page again, like a frame within a frame loop. A few refreshes later, I was looking at several "copies" of the home page embedded within another. Also, clicking Latest Links and Top Hits produced the same result as clicking refresh.
I assume this issue has to do with the IF statement I'm using there in my main.tpl file.
Any ideas for how I can get this working?
cheers
SAM :)
solutionsphp
08-29-2005, 05:12 AM
Seems that PHP code for rotating was the issue. I'm running the same thing now using JS instead with no problems.
One thing I've noticed... it's certainly not uncommon for web admins to want to show something only on the home page. Using that IF statement in the smarty template gets the job done... almost. The Latest Links and Top Hits links in the top bar generate pages that are also considered "$category.ID == 0", so anything set to display only on the home page is also inadvertantly displayed on these 2 pages.
Overall, this isn't a problem really, but it would be nice to have a bit more flexibility template-wise, so that one can more accurately assign content to specific locations in the directory.
cheers
SAM :)
Ap0s7le
08-29-2005, 05:46 AM
Hey Sam, it's best to keep PHP out of the templates, as things can get really ugly.
Also, for the IF you spoke of above, try this instead
Content visible to registered users only.
Should keep it out of the other pages you mentioned.
later bro
solutionsphp
08-30-2005, 05:55 PM
Thanks Casey! The IF statement you provided works wonderfully. Very handy. I'm using various PHP in the main.tpl, and so far things are working well, but I will keep an eye out for any ugliness that might rear it's head.
SAM :)
ksbhati
08-30-2005, 09:27 PM
Hi Casey,
How does one keep the home page text out of the search results page? Your code above works fine except for the search results page where the home page data shows up.
Thanks
kickass
08-30-2005, 11:52 PM
Hey solutionsphp!
You already know that doing core code changes is gonna impact you in future if there are necessary upgrades to this script. It's better to write what you need in a separate php file and call it into your template via a separate smarty tag. That way any important changes are in your template and your own separate files, and not in core code.
If you have questions about how to do that there's a very good forum here:
http://www.phpinsider.com/smarty-forum/index.php
Smarty templating is AWESOME when it's used correctly . . . makes a lotta stuff forward and backward compatible that wouldn't be otherwise. Right, Casey?
Dariusz
01-04-2006, 10:52 PM
Content visible to registered users only.
works great however it does not prevent from adding same content to the submit link page.
I'd like to include a banner from a "top sites" site and it needs to show up at the front page only.
Can someone tell how to exclude also a submit page please?
Try this ...
Content visible to registered users only.
:)
Dariusz
01-05-2006, 09:35 PM
thank you, but "not $gu" didn't work
I have already half sorted out this problem - this code works as it should with main template but problems start when you put it in footer.
main template isn't exactly place where I want to place that banner but have to make it this way as there is no other solution at the moment.
tlinu
01-06-2006, 07:07 PM
Hey freind:
It is very hard to get a back links from google PR sites.
But I found a site, where I joined. within 3 days I got 87 back links and most of them has PR2 to PR7
I am sure my PR will improve to PR6 on next update.
I just thought sharing this with you all. Here is the Link
{old non working url removed}
vBulletin® v3.8.0, Copyright ©2000-2012, Jelsoft Enterprises Ltd.