Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / if statement for additional text in tpl_main_page.php

if statement for additional text in tpl_main_page.php

Locked

Views: 617

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
29 Jan 2009, 3:23 PM
#1
mydanilo avatar

mydanilo

Totally Zenned

Join Date:
Dec 2004
Posts:
1,024
Plugin Contributions:
0

if statement for additional text in tpl_main_page.php

I wanted to use EZpages text to display below the category pictures.
I started with this code:

<!--bof- SEO Ezpage text -->
<div id="seo_content">
	<?php 
    $page_query = $db->Execute("SELECT pages_html_text FROM zen_ezpages WHERE pages_title='SEO'");
    $seo_text = $page_query->fields['pages_html_text'];
    echo $seo_text;
    ?>
</div>
<!--eof- SEO Ezpage text -->

It displays the text where I want it BUT now it shows on all pages. Could I put an if statement to make it ONLY show on the home page? I have tried but my php is not solid at all. Any suggestions?

29 Jan 2009, 9:20 PM
#2
mydanilo avatar

mydanilo

Totally Zenned

Join Date:
Dec 2004
Posts:
1,024
Plugin Contributions:
0

Re: if statement for additional text in tpl_main_page.php

I think this should work. Any comments on the code appreciated. Just getting my feet wet with php.

<!--bof- SEO Ezpage text -->
<div id="seo_content">
<?php
if ($this_is_home_page) {
    $page_query = $db->Execute("SELECT pages_html_text FROM zen_ezpages WHERE pages_title='SEO'");
    $seo_text = $page_query->fields['pages_html_text'];
    echo $seo_text;
    } ?>  
</div>
<!--eof- SEO Ezpage text -->