Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Adding another text section to homepage

Adding another text section to homepage

Locked

Views: 4,256

Results 1 to 20 of 25
This thread is locked. New replies are disabled.
5 Jul 2008, 8:59 PM
#1
nick_h avatar

nick_h

New Zenner

Join Date:
Apr 2008
Location:
Nottingham, UK
Posts:
46
Plugin Contributions:
0

Adding another text section to homepage

Hello,

One of my clients wants an editable section of text adding to the bottom of his Zencart homepage for SEO purposes. I am thinking that maybe I could use an EZPage for this task, and just not have it show up on any menus.

So I will need to pop in a bit of PHP to pull the page content from the database and display it on the page. I tried this:

<?php 
$seo_text = "SELECT pages_html_text FROM ezpages WHERE pages_title='SEO'"; 
print($seo_text); 
?>  

but it just displayed the text of the query, not the EZpage contents. Sorry for being a n00b, but what would i need to add to make this work?

thanks :D

Nick

5 Jul 2008, 10:02 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Adding another text section to homepage

I'm not a mySQL expert, but this adapted from other database queries might work:

<?php 
$seo_text_query = "SELECT pages_html_text FROM ezpages WHERE pages_title='SEO'"; 
$seo_text = $db->Execute($seo_text_query);
?>
5 Jul 2008, 10:46 PM
#3
nick_h avatar

nick_h

New Zenner

Join Date:
Apr 2008
Location:
Nottingham, UK
Posts:
46
Plugin Contributions:
0

Re: Adding another text section to homepage

Hi Glenn,

Thanks for your quick reply, your comments put me on the right track and this code pulls out the EZPage content onto the page:

<?php 
$page_query = $db->Execute("SELECT pages_html_text FROM ezpages WHERE pages_title='SEO'");
$seo_text = $page_query->fields['pages_html_text'];
echo $seo_text;
?>

Cheers for your help :smile:

Nick

28 Jul 2008, 3:11 AM
#4
caga595 avatar

caga595

New Zenner

Join Date:
Jun 2008
Posts:
12
Plugin Contributions:
0

Re: Adding another text section to homepage

I'm trying to do the exact same thing for one of my clients. Can you tell me which file you edited with the new seo_text code to make the text appear on the home page? Thanks.

28 Jul 2008, 7:56 AM
#5
nick_h avatar

nick_h

New Zenner

Join Date:
Apr 2008
Location:
Nottingham, UK
Posts:
46
Plugin Contributions:
0

Re: Adding another text section to homepage

Hi,

I put it in right at the bottom of my tpl_main_page.php that is in my skin file template over-ride folder. The EZ-Page is called SEO. The code/page content could go anywhere I suppose, but my client wanted it off the bottom of the page. Hope this helps :smile:

Nick

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

</body>
29 Jul 2008, 2:32 AM
#6
caga595 avatar

caga595

New Zenner

Join Date:
Jun 2008
Posts:
12
Plugin Contributions:
0

Re: Adding another text section to homepage

Thanks for the reply. I'm gradually figuring out how this whole cart is assembled. Can you help me find where to post the other piece of code (SELECT code)? Thanks.

29 Jul 2008, 2:46 AM
#7
caga595 avatar

caga595

New Zenner

Join Date:
Jun 2008
Posts:
12
Plugin Contributions:
0

Re: Adding another text section to homepage

Actually, I got past the question in my previous post but keep getting this error:

1146 Table 'mikoncor_mainstore.ezpages' doesn't exist
in:
[SELECT pages_html_text FROM ezpages WHERE pages_title='SEO']

29 Jul 2008, 4:20 AM
#8
caga595 avatar

caga595

New Zenner

Join Date:
Jun 2008
Posts:
12
Plugin Contributions:
0

Re: Adding another text section to homepage

I figured it out. Thanks for all the help.

29 Jul 2008, 5:36 AM
#9
nick_h avatar

nick_h

New Zenner

Join Date:
Apr 2008
Location:
Nottingham, UK
Posts:
46
Plugin Contributions:
0

Re: Adding another text section to homepage

Glad you got it sorted :P

Nick

29 Jan 2009, 2:55 PM
#10
mydanilo avatar

mydanilo

Totally Zenned

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

Re: Adding another text section to homepage

WOW. This is what I have tried to do for some time. Have tried to do it with the defines pages.

I like this solution a lot better. With EZpages you can format the text the way you want and don't need to hard code the whole html into a file like others suggested. I love it. Thank you very much.:clap:

29 Jan 2009, 3:00 PM
#11
mydanilo avatar

mydanilo

Totally Zenned

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

Re: Adding another text section to homepage

Oh no! I was celebrating too fast. The text loads now on every page. All I want is that it load on the home page. Any ideas?

29 Jan 2009, 8:33 PM
#12
nick_h avatar

nick_h

New Zenner

Join Date:
Apr 2008
Location:
Nottingham, UK
Posts:
46
Plugin Contributions:
0

Re: Adding another text section to homepage

How about a PHP if statement that only pulls that EZ page when displaying the homepage?

Nick

29 Jan 2009, 8:50 PM
#13
mydanilo avatar

mydanilo

Totally Zenned

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

Re: Adding another text section to homepage

Yes exactly, can you help me with that? I struggle...

29 Jan 2009, 9:00 PM
#14
mydanilo avatar

mydanilo

Totally Zenned

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

Re: Adding another text section to homepage

Probably something like:

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

</body>

?>
29 Jan 2009, 9:08 PM
#15
mydanilo avatar

mydanilo

Totally Zenned

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

Re: Adding another text section to homepage

Sorry try again:

<!--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 -->

Seems to work. Does this look correct?

30 Jan 2009, 10:11 AM
#16
nick_h avatar

nick_h

New Zenner

Join Date:
Apr 2008
Location:
Nottingham, UK
Posts:
46
Plugin Contributions:
0

Re: Adding another text section to homepage

My PHP skills are sadly lacking, but that seems to make sense! Is that in use on your site now?

I was wondering whether having the same SEO text on each page would actually be harming results instead of helping.. so this could come in handy.

Nick

30 Jan 2009, 12:58 PM
#17
mydanilo avatar

mydanilo

Totally Zenned

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

Re: Adding another text section to homepage

I use it for additional text below the category pictures. I don't want the whole blabla taking up most of the page and customers would not even see the pictures. This way, the most important intro text is on top, then pics, then I can put more text for the customer AND search engines to get enough content on the home page.

If you want to put the most important keywords as the last thing on every page, put it in the footer. Too much text that repeats on every page might not be great for SEO.

And yes, I implemented this on the first site in my signature.

31 Jan 2009, 3:36 PM
#18
nick_h avatar

nick_h

New Zenner

Join Date:
Apr 2008
Location:
Nottingham, UK
Posts:
46
Plugin Contributions:
0

Re: Adding another text section to homepage

Good stuff! Thanks, I may well use that on an upcoming site :)

Nick

17 Oct 2009, 6:20 PM
#19
matt_smith avatar

matt_smith

Zen Follower

Join Date:
Oct 2008
Posts:
108
Plugin Contributions:
0

Re: Adding another text section to homepage

Hi

Great thread - just what I have been searching for. followed instructions, but is is not working. See bottom of homepage.

http://trulyethical.com

Can anyone help?

Thanks

matt

17 Oct 2009, 9:18 PM
#20
pdxdoug avatar

pdxdoug

Zen Follower

Join Date:
Jan 2008
Location:
Portland, Oregon USA
Posts:
356
Plugin Contributions:
0

Re: Adding another text section to homepage

I wanted editable text both above and below my featured items and bunyip provided these simple steps:

http://www.zen-cart.com/forum/showpo...31&postcount=6

His solution works perfectly. His method uses define_pages rather than ez-pages.