Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Add text to home page footer only
 
Trevor Smith99
Jr. Member
 
Total Posts:  13
Joined:  2010-05-17
 

HI,
I would like to add some SEO friendly text to the footer of my home page only.
I have tried a couple of methods already but it still appears on the footer of all pages.

Any help appreciated.

Thanks
Trevor.

 
Magento Community Magento Community
Magento Community
Magento Community
 
prateekgupta
Guru
 
Avatar
Total Posts:  541
Joined:  2010-06-04
India
 

Hey,

I dont know how much you will like this solution. But it will work.
In the footer.phtml file try getting the url of the page . You can use the php function $_SERVER[’PHP_SELF’] and in that string find the string home (or any other name you have assigned to your home page) and use that in the condition if and else to display whatever you want to show smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Trevor Smith99
Jr. Member
 
Total Posts:  13
Joined:  2010-05-17
 

Thanks for the reply.

I will try this out and let you know.

Trevor

 
Magento Community Magento Community
Magento Community
Magento Community
 
webkul
Sr. Member
 
Avatar
Total Posts:  159
Joined:  2010-10-27
 

Footer Links are controlled by static block and XML . There are many ways to do that , one method is here

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('block-identifier')->toHtml() ?>

add this code in the top of template and make a static block with the same block-identifier . will solve the problem

 
Magento Community Magento Community
Magento Community
Magento Community
 
Trevor Smith99
Jr. Member
 
Total Posts:  13
Joined:  2010-05-17
 

Hi, Webkul.
That made my footer disappear on all pages.
long face

 
Magento Community Magento Community
Magento Community
Magento Community
 
Trevor Smith99
Jr. Member
 
Total Posts:  13
Joined:  2010-05-17
 

I need the text only only to appear on the homepage footer, even though the footer is the same throughout the site.

Thanks again for the help.
Trevor

 
Magento Community Magento Community
Magento Community
Magento Community
 
Commative
Sr. Member
 
Avatar
Total Posts:  130
Joined:  2009-12-03
XXX
 

You could try using this:

<?php if ($this->getIsHomePage()):?>
    
<!-- Homepage Footer Text Here -->
<?php else:?>
    
<!-- Footer Text Here If Not Homepage (Optional) -->
<?php endif?>

Although, one problem you’re going to run into is that the footer is cached, so you may not see a change even if your php is correct. The reason these dynamic things work in the header is because the header is excepted from the cache.

Magento Themes by Magentist

 
Magento Community Magento Community
Magento Community
Magento Community
 
Trevor Smith99
Jr. Member
 
Total Posts:  13
Joined:  2010-05-17
 

Thanks for the help guys, but I can’t get any of these to work.

I can get the text on all pages, but not exclusively the home page. I didn’t realise it would be so tricky.

I will have another look at it tomorrow.

Trevor

 
Magento Community Magento Community
Magento Community
Magento Community
 
hfries
Jr. Member
 
Total Posts:  1
Joined:  2010-11-04
 

Hi!

I solved this problem by creating a new base Template for the home page. Just copy the 1-column or what ever you use and add your static block:

<?php echo $this->getLayout()->createBlock(\\\'cms/block\\\')->setBlockId(\\\'home_footer\\\')->toHtml(); ?>

and applied it by overriding the XML in the home page:

<reference name=\\\"root\\\">
            <
action method=\\\"setTemplate\\\"><template>page/1column-home.phtml</template></action>
        </
reference>
 
Magento Community Magento Community
Magento Community
Magento Community
 
Trevor Smith
Jr. Member
 
Avatar
Total Posts:  5
Joined:  2009-07-26
 

Hi hifries,
Thanks for the reply.
Prateek solved this for me after overcoming the caching problem that Magentist flagged.
Thanks again for the support.
Trevor
http://ringelmatz.de

 
Magento Community Magento Community
Magento Community
Magento Community
 
seudo
Guru
 
Avatar
Total Posts:  344
Joined:  2008-04-21
 

Another method that wouldn’t require creating template files or editing template files would be the use of the Layout Update XML within the home cms page and use a static block to place the seo text.

So you would first:
Create your static block with your html in it.

Insert this code in the Layout Update XML:

<reference name="footer">
            <
block type="cms/block" name="seo_text" after="-">
                <
action method="setBlockId"><block_id>seo_text</block_id></action>
            </
block>
</
reference>

Refresh your cache and you should see the SEO text appear below the other footer links only on your home cms page.

Just another way to accomplish the same thing in Magento.

Thought I’d share!

 
Magento Community Magento Community
Magento Community
Magento Community
 
mleahy
Jr. Member
 
Total Posts:  2
Joined:  2012-06-19
 

This is great information! Is there a way to make the static block show before the links instead of below them?  I tried the same code with before="-", but it had no effect.  It was still below the links.

Turns out it is working when I use before="-".  The only issue now is that even though I put the static block in the home page XML Layout in Design under CMS, it is showing on all pages.  Any reason why that would be happening?

Thanks for your help!

8-)

 
Magento Community Magento Community
Magento Community
Magento Community
 
smlaci
Sr. Member
 
Avatar
Total Posts:  122
Joined:  2008-04-15
Bacau
 

@seudo method seems great but I can’t get it to work with the Modern Theme. any suggestions?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top