0

Details

  • I already have the .phtml file
  • The actual path = /var/www/html/store/app/design/frontend/base/default/template/page/distributors.phtml

After doing some research I found that I will have to add this

{{block type="core/template" template="/var/www/html/store/app/design/frontend/base/default/template/page/distributors.phtml"}}

Where exactly are we suppose to add this ?

I logged in to Mogento Admin. Go to CMS > Pages > Add New Page, and then I don't know what else to do ?

Can someone help shed the light on this ?

Thanks.

1 Answer 1

1

If you're looking to add this .phtml script inside the middle of a CMS page, you can paste that text right into the content area of the CMS page's WYSIWYG editor. Magento will know to parse the text out, detect the block, and render out your view script.

Note: your "template" attribute includes too much, you only need to specify the path afer the "template" directory. A name to your block is also required, otherwise it will not be rendered. So, it should be more like this:

{{block type="core/template" name="my_distributors_block" template="page/distributors.phtml"}}

I'm going to assume this .phtml file, despite being located in the "page" directory, is just a small block which you'd like to render within a page. (NOT an entirely new page layout). If this "discributors.phtml" script is indeed a page layout, then this answer is not what you're looking for.

Lastly, you really should be putting this .phtml file within your own theme directory, not base. Unless this view script belongs to an extension which you plan to re-use for multiple projects. I'd suggest reading up on how to configure Magento to use your own theme, and the fallback logic Magento uses to find view scripts.

6
  • I pasted this {{block type="core/template" name="my_distributors_block" template="page/distributors.phtml"}} in. Save > Preview. I didn't see any changes. :( Commented Jan 13, 2015 at 19:38
  • Have you tried turning logging on under System -> Configuration -> Developer -> Log Settings. Afterwards, load up your page on the front end, then check to see if there is any errors logged in system.log or exception.log? Commented Jan 13, 2015 at 19:41
  • No I have now, but I will do it now. Commented Jan 13, 2015 at 19:43
  • My guess is your path to your template file may be slightly off. Just to confirm, you're looking to add a small "block" within your cms page's main content area right? Not define an entirely new layout for the page. Commented Jan 13, 2015 at 19:46
  • I am looking to add a small block. How do I check to see if I have the correct path ? I am sure the file(distributors.phtml) is there because I moved it into my server using WinSCP. Plus, I saw the file there as well when I refresh Commented Jan 13, 2015 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.