Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Using if on index page

Using if on index page

Locked

Views: 866

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
15 Oct 2007, 2:14 PM
#1
jgkiefer avatar

jgkiefer

Zen Follower

Join Date:
May 2004
Posts:
64
Plugin Contributions:
0

Using if on index page

I have am image I only want to display in the home page. I want to use an "if" statement to do this. What would be the correct syntax to use to accomplish this?

Here is the code string that I want only on the home (index) page.

<tr> <td width="500"><img src="<?php echo DIR_WS_TEMPLATE_IMAGES; ?>az_info_image.jpg"></td></td> </tr>

Thanks-

15 Oct 2007, 2:54 PM
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Using if on index page

Better would be to put your image in your template's images folder and then use the following

<?php
if ($this_is_homepage) {
  zen_image($template->get_template_dir('az_info_image.jpg', DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . 'az_info_image.jpg', 'image alt text', 'image width', 'image height');
}
?>

You don't need the table stuff unless you're trying to give your HTML a 1990s retro vibe.

15 Oct 2007, 5:23 PM
#3
jgkiefer avatar

jgkiefer

Zen Follower

Join Date:
May 2004
Posts:
64
Plugin Contributions:
0

Re: Using if on index page

"You don't need the table stuff unless you're trying to give your HTML a 1990s retro vibe."

LOL - the template I am using contains some tables. I know, how old school. :)

Thanks so much.

16 Oct 2007, 7:30 PM
#4
jgkiefer avatar

jgkiefer

Zen Follower

Join Date:
May 2004
Posts:
64
Plugin Contributions:
0

Re: Using if on index page

This does not seem to work, any other suggestions?