Well hi,
I am here with another question.
I'd like to code something in my index.template.php.
I would like to show an image in the top of my page when I am on the frontpage, but not in any other action or page.
There exists a check like "if ($context['current_action'] == 'myaction')".
However, that one doesn't work I guess, what would I need for the frontpage?
Thanks in advance!
Not knowing what set up you have, it would help if you could give us the info in the Posting Guidelines (http://www.tinyportal.net/index.php?topic=581.0) this can also be found in the post/reply page.
I think $context['TPortal']['is_frontpage'] is what you're looking for.
Tip:
When you want to know what is available you can use a couple of functions in PHP to see this:
vardump() or print_r(). I usually do it like this at the bottom of my page in a block to see what is in $context.
echo '<pre>', print_r($context['TPortal']) ,'</pre>';
At Lesmond: Well the set up wasn't really necessary since it was a coding question :)
There isn't a forum about coding I believe..
@ IchBin: thanks, that's exactly what I am searching for!
Heero,
Actually, Lesmond's request for the information contained in the posting guidelines was indeed necessary since coding for SMF 2.0 is drastically different that coding for previous versions of SMF. In any case, since there is no Coding Forum per se, this topic would be better placed into the Support Forum than the International Forum and I will move it there now and mark the topic solved.
ZarPrime
Oh like that, I am sorry.
Also, it bugs.
In stuff like mypage.com/index.php?topic=30 it also shows the echo.
Or is that normal?
I am using SMF 2.0 RC3 & TinyPortal 1.0 beta 5.2.
I'm not sure that anyone understands your last question. Can you post a link to an example and perhaps explain that last question a little better?
ZarPrime
I am sorry for the late reply, was a bit busy last days :-).
And giving an example is hard but I'll try to explain better.
I would like to show an image when I am on the portal main.
Example: http://www.tinyportal.net/index.php --> this is the portal its main of the tiny portal support website.
Using the code which IchBin provided, it works. But not for each section of the website.
When I am checking topics in a board the image still shows up, which it shouldn't.
Example: http://www.tinyportal.net/index.php?board=25.0 --> the image would also be shown here.
My question is how to fix this since only the portal main should contain it.
Thanks in advance!
Heero,
I'm not quite sure just exactly what you are trying to do but TinyPortal will let you put a picture just on the FrontPage just by placing it into a block in the panel of your choice. You can easily set this block to show only on the FrontPage and no place else.
For instance, I just placed a block into the upper panel on my test site that has a picture of some of the old TinyPortal Team. That block is set to show only on the FrontPage and you can see it here, at least for awhile --> http://talesofthehavenexpanse.com/smf2test/index.php
ZarPrime
Thanks for your reply, I appreciate your help a lot.
But I finally found the code how to make it work properly.
It would be:
if ($context['TPortal']['is_frontpage'] != !empty($context['current_board']))
in order to show content on the frontpage and not on other pages as for example in boards.