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

Static Block in header? 
 
puntable
Member
 
Avatar
Total Posts:  50
Joined:  2011-02-24
Denmark
 

Hello all

I’ve been searching the net, but cant find a working solution for my problem. Basically what i want, is to put the Facebook like button in the header right below the searchbar and account links. See my attached picture.

I’m guessing that i need to create a static box and paste the code from Facebook, but which file(s) do i need to edit to make it show as my picture.
Hope you understand smile

Image Attachments
example.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
 
thylaksoft
Sr. Member
 
Avatar
Total Posts:  78
Joined:  2009-12-10
New Castle, DE
 

Just go to the header.phtml file
path:app/design/frontend/default/YOURTHEME/template/page/html/

and write your design codings under the following line
<?php echo $this->getChildHtml('topLinks') ;?>

Thylaksoft LLC

http://www.thylaksoft.com
302-355-0449

 
Magento Community Magento Community
Magento Community
Magento Community
 
Template fans
Guru
 
Total Posts:  446
Joined:  2009-11-02
 

Creating a Static Block:

A. Go to the Magento Admin panel and then select the CMS -> Static Blocks.

B. Then Click on the “Add New Block” button from the right top .

C. Now fillup the following fields:

Block Title: Give the Name of the static block here. This will not show on the frontend.
Identifier: Give the id of this block. It used as reference of this block, when adding to a template file or CMS page.
Status: Its define visibility of this static block on the frontend.
Content: Content of static block can be plain text, HTML code and Javascript. PHP code can’t use in this area.

D. After fillup all fields then click on “Save Block” button from the right top .

Showing a Static Block in Frontend:

A static block can be added to display on the frontend by some different ways which are discribed bellow:

1. Adding a static block to a CMS page From the Magento admin:

Go to CMS > Pages and click on a pre-existing page or create a new page where you want to show your static block.

Now use the following code in the Content field of the CMS page:

{{block type="cms/block" block_id="your_block_identifier" template="cms/content.phtml"}}

2. Adding a static block by using template phtml file:

Open your phtml file where you want to add the static block.

For Example: /app/design/frontend/your-instance-name/your_theme/template/callouts/right_col.phtml

Then you can use the following code in your phtml file to show the content of your ststic block:

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

3. Adding a static block by using XML layout file:

Use the following code to show the content of static block by using Layout XML file:

<reference name="content/left/right">
<block type="cms/block" name="your_block_name" before="-">
<action ethod="setBlockId"><block_id>your_block_identifier</block_id></action>
</block>
</reference>

Note: You can use the above code to show the block content in specific page by using “ Layout Update XML ” field of CMS page.

To do this go: CMS -> pages from your magento backend. Then click on on that page where you want to show the static block.

Then click on Design tab from left panel like:

Now Past the above code in Layout Update XML field.
here i wrote <reference name=”content/left/right”> in code. You must use only one like- content / left or right as your reference name.

 
Magento Community Magento Community
Magento Community
Magento Community
 
puntable
Member
 
Avatar
Total Posts:  50
Joined:  2011-02-24
Denmark
 

Thank you very much both for helping smile Got it working now.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lohitm86
Jr. Member
 
Total Posts:  1
Joined:  2013-06-02
 

thank you so much.. but how to identify which xml file we need modify?

 
Magento Community Magento Community
Magento Community
Magento Community
 
G_Mehta
Guru
 
Avatar
Total Posts:  418
Joined:  2010-01-27
India
 

If you want to add CMS pages into navigation menu then please look on below blog post. Its a extension which helps to add CMS pages into navigation menu without writing any code.

http://mehtagaurav.blogspot.in/2011/11/magento-navigation-menu-of-cms-pages.html

Cheers!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Monty_iLM
Guru
 
Total Posts:  450
Joined:  2013-11-05
 

Hi,

Check this thread http://bmehla.wordpress.com/2011/05/04/magento-steps-to-add-static-block-into-the-header-area-of-magento-site/

Hope this will help you!!

Thanks

Monty
iLoveMage

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