PDA

View Full Version : About widgets in article pages


Sdahe
12-04-2010, 10:33 PM
Hello,

I'm looking for a mod that would let me have a widget in the front-page (content.php) but not in the articles page. Let say I would like to have a banner or a video in the front-page only...and when a person clicks on an article that banner is not there.. just in the front-page.

Can this be done?

Lynne
12-04-2010, 11:04 PM
You may create a widget and use a custom template with the widget (enter name into Configure screen) and then put a condition around the template to only show it on the main page.

Sdahe
12-05-2010, 04:32 PM
You may create a widget and use a custom template with the widget (enter name into Configure screen) and then put a condition around the template to only show it on the main page.
Sorry but I'm not much of a programmer... can you tell me how to do it.. thanks

Lynne
12-05-2010, 08:17 PM
Well, I'm not going to do it for you (and I can't since you didn't provide enough info), but copy the template that the widget uses (as I said, it is listed in the Configure screen) and put it in a new template and then put a condition around it - something like this:
<vb:if condition="$_GET['r'] == '1-your-page-name' OR !$_GET['r']">
template code
</vb:if>

Sdahe
12-05-2010, 10:33 PM
Well, I'm not going to do it for you (and I can't since you didn't provide enough info), but copy the template that the widget uses (as I said, it is listed in the Configure screen) and put it in a new template and then put a condition around it - something like this:
<vb:if condition="$_GET['r'] == '1-your-page-name' OR !$_GET['r']">
template code
</vb:if>
Thank you very much...

The only thing I have to change is where it says 1-your-page-name right?... that would be content.php right?

Lynne
12-05-2010, 10:41 PM
No, it would be the name of the home page. Many leave out that part of the condition because usually you get there via just clicking Home and then there is no r=whatever at the end of the url. But, if you go there via a link, it will have that attached at the end.

Sdahe
12-05-2010, 10:42 PM
Get it

So the code would be like this... right?

<vb:if condition="$_GET['r'] == '' OR !$_GET['r']">
template code
</vb:if>

--------------- Added 1291596570 at 1291596570 ---------------

Perfect... it's working great

Thank you very much