Forums / Setup & design / How do I find source codes for pages?

How do I find source codes for pages?

Author Message

Rob Hard

Saturday 15 December 2007 10:12:17 pm

I am trying to figure out how to add source codes in EZ Publish 4.0 -- looking to add code for Google Analytics and site advertisers. How can I see the HTML coding used for EZ Publish? It isn't an option in the site administration as far as I can see. How should I go about insert these codes? When I paste the Google Analytics text into the body area of the page, the codes appear in my published document or -- if I try viewing it before publishing -- I get an error message that indicates it cannot recognize the <script> code. Thanks.

Greg McAvoy-Jensen

Saturday 15 December 2007 10:46:13 pm

The source code is php found in the kernel and lib directories. But eZ Publish is designed so that developers don't need to touch the php code; indeed, any changes made would be overwritten the next time you do a software update.

You're looking for templates. The are found in the design directory. The one called pagelayout.tpl is the overarching template; it also displays data from other templates using "module_result.content".

Proper form for working with templates is to always leave the originals (again, so software updates are smooth and effective). They stay behind as backups to the templates you create. Start by copying an existing template you need and make an override rule to call it when you want it. Best practice is to package all this as a new design extension, but extensions have their own learning curve, so at first you can just put your templates inside the design directory.

Learn more about the template system here: http://ez.no/doc/ez_publish/technical_manual/3_10/templates.

Also, you should be aware that much functionality you might need already exists in the form of extensions. For example, you can learn about how to install a pre-packaged Google Analytics extension by Brookins Consulting here: http://ez.no/developer/articles/how_to_use_ez_publish_extensions_google_analytics.

Granite Horizon, Certified Developer of eZ Publish Web Solutions
Provider of the SaaS Solution Granite Horizon In The Cloud | http://granitehorizon.com/cloud
http://granitehorizon.com | +1 916 647 6350 | California USA | @granitegreg
Blog: http://granitehorizon.com/blog

Piotrek Karaƛ

Sunday 16 December 2007 12:00:59 am

If I understand correctly, you are trying to place an advertising zone within your templates. As Greg suggested, this is mainly template work.

Since invocation codes are usually javascript, <b>literal</b> template function may be useful in your case:
http://ez.no/doc/ez_publish/technical_manual/3_10/reference/template_functions/miscellaneous/literal

Also, when you want to manage your zones, you may want to designate one attribute in content classes to store different invocation codes (text block would be the best, I believe), and then modify the templates so that they simply display this particular attribute's content within literal function.

Hope this helps.

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Rob Hard

Sunday 16 December 2007 9:23:05 am

Thanks guys.

I'm not so much a developer as I am a writer/content person, so if my questions seem a bit simple, my apologies for that. Even after reading the write up on the templates section and literal, I'm not sure exactly where I make those revisions. That is, when I go into site administration I can't figure out how to get into the template source code of a page... The only option I see is to fill out the form fields, and inserting the literal code there didn't work.

I have another related but different question to this as it relates to the site template. That is, I think I should have selected the more powerful template than I did when setting up the site, and I don't know how to go about changing it. I think I need the more interactive media type of site -- which I think is currently used on Piotrek's site (mediaSITE). How do I go about changing to that approach? To see what I'm creating so far, my site www.threedaydestinations.com.

Last, as it relates to the template pages, the only other question I have is related to modifying a folder page -- for an example, see: http://www.threedaydestinations.com/index.php/eng/Travel-Europe/Travel-Barcelona

I recognized how to insert a table, but when I insert text into a two column table, the right side of the column moves/adjusts. My intent is to create a template on this page that allows a right column for advertising on this page and the pages below it there. I will probably have ads on the upper level pages as well, but noticed that the frontpages have a right column where I can drop ads.

Thanks for your advice. I noticed both of you provide consulting services, perhaps this may be a quick project?