Page Content

The purpose of page content is to, through Perpetua, give the client the ability to update content (such as flash elements, links, text, etc.) that do not fall within the fusebox.layout content area on the page and cannot be added through an Add Items module. This will discuss the elements that are needed to create page content, how to add page content areas to a site, and how flash reads page content.

Page Content can be VERY in-depth and confusing. So follow along closely and try not to hurt your brain.

 

Files Used For Page Content

We will expand upon some of these files and their uses later, but for now, here are the files we are using for Page Content:

Folders Used (under site's root HTML folder):

/config/xml/pagecontent/
      • _default.xml — default configuration file for site
      • _default_#PageID#.xml — default configuration for a specific page

/xml/pagecontent/ (created by perpetua)
      • #PageID#.xml — content to use for the specific page and it's children
      • layout.xml — default content for pages to use without a specific #PageID#.xml (can be named anything; referenced in either _default.xml or _default_#PageID#.xml as the default or xmloverride attributes)

 

Configurations

Page content is generated from an xml file that we create. In that xml file, we add nodes that have attributes which determine the type of page content area it is, and what it will do.

When we add page content to a site (we will address this later) it looks for a file within the config/xml/pagecontent folder called _default_#PageID#.xml. If that page ID number does not match the current page's ID number it looks for _default.xml and reads that file's configuration. If that file does not exist, it ignores page content and does not add it to the Page Properties menu.

If the page finds one of the configuration files, Perpetua will create a new xml file within xml/pagecontent/ folder for that specific page. it will then read the data stored within that xml file, and put it in the proper location that we have specified in our layout file.

It does all this by reading xml nodes referenced by the layout file and creates specific user menus for the client to add data. Here is a list of the attributes that can be added to a node to determine those elements that are given to the client to edit:

     • name
          – Name of the region (i.e. "Event Box" — this is what is shown to the client)

     • action (usually used for rotators or button rollovers)
          – static (shows the first element in the list and stays there for rotators)
          – sequential (rotates through all the images in sequential order for rotators)
          – random (shows a single random image and stays there for rotators)
          – rollover (automatically shows a second image option for over state)

     • flashfile (no longer used)
          – name of .swf file in the images/layouts folder

     • count (number of elements)
          – number (if this number is 0, it is set to unlimited)
          – dyn (sets it to be a dynamic number — then specified by user and usually has a mincount/maxcount to give a range)

     • mincount (if count is "dyn")
          – number (minimum number of groups allowed in this region; 0 = unlimited)

     • maxcount (if count is "dyn")
          – number (maximum number of groups allowed in this region; 0 = unlimited)

     • type (type of element; bracketed areas are optional)
          – image[|w[:h]] (image file such as a jpg; optional width and height)
          – file (a file such as a pdf or video)
          – link (a url link)
          – heading_text[|w] (single line text input area; optional set width)
          – blob_text (standard multiline text area)
          – blob_html[|{element options}] (wysisyg-enabled text area; optional html options specified, separated by a colon ":")
               - a : link
               - b : bold
               - i : italic
               - img : image
               - t : table
          – color_picker
          – checkbox
          – media_library
          – date

     • spacers (comma-separated list containing none, one, or both of the following)
          – before (adds a spacer before the field)
          – after (adds a spacer after the field)

     • xmloverride (used to override the page's Perpetua created default xml file for inheriting content saved for one page to be updated on other pages; cannot be used unless Page Content Inheritance is checked in Perpetua Console)
          – #filename#.xml (This can be named anything. Perpetua will create a specific xml file with this name in the /xml/pagecontent folder to be used by any other node in another configuration file that calls the same xmloverride file name.)

     • pageoverride (used to override the xmloverride; only can be used when using xmloverride; cannot be used unless Page Content Inheritance is checked in Perpetua Console)
          – if set to 0 (will not override the xmloverride)
          – if set to 1 (will add to client menu the options to Use Default, Override Default, or Set Default, so for any specific page, the client can have those options to modify the xmloverride)

     • order (default: 0, optional: a number used to sort the dropdown in the Admin window, which allows you to add new content sections to the bottom and still have it appear in the admin where you want it)

 
 

Inheritance

If Page Content Inheritance is checked in Perpetua Console, a Sub page will inherit the page content from it's parent or grandparent if it does not have it's own configuration file. This can be confusing, however, for child pages of the site. These pages are NOT children of the home page, they are child pages of the site which never has any page content. So the top level pages (main pages) will not inherit page content from the home page, they either need to have their own page content, pull page content from the _default.xml configuration file or have specific elements that pull from a default (i.e. layout.xml) or xmloverride xml file (i.e. servicetimes.xml).

So, say we have a main level page called Youth which is a child page of the site. Youth has a child page called Downloads. If Youth has it's own page content xml file created and saved, Downloads will try to get it's page content from an xml file named with it's own pageID. If there is none created or saved yet, it will pull the xml file created by Youth.

Therefore if we are creating a sub brand within an existing site, and are relying on the sub pages of the sub brand to pull page content from the sub brand's home page, the sub pages always have to be children of the home page. If they are children of the site, children of other pages, or children of themselves (i.e. hidden pages) they will not inherit the page content from the homepage since they are no longer it's child and the page will break.

Currently, the inheritance only goes three levels deep: Parent - Child - Grandchild. If the page is on the fourth level (a Great Grandchild), it will currently NOT inherit page content from it's Great Grandparent (or the Main Parent page).

Adding Page Content

To add page content to a site, we first need to asses how many areas on the page will be using page content. Because of it's complexity, do your best to keep the number of page content areas to a minimum. 

For links that need to be updatable by the client, use page aliases instead of page content.

Setting Up The XML File

The first step to create our page content is to create/modify our configuration file. If this is going to be page content for a specific page ID (i.e. the home page), create an xml file called _default_#PageID#.xml within the /config/xml/pagecontent/ folder. If this is going to be the default page content for all pages without specifically different page content to pull from (i.e. all sub pages), create within the same folder an xml file called _default.xml.

Within this file start adding your page content areas into specific <content> nodes of page content areas within a containing <root> node like this example:

<?xml version="1.0" encoding="UTF-8"?>
<root default="layouts.xml">
  <content name="Header Image" action="" count="1" pageoverride="1" xmloverride="subpage-header.xml">
    <item name="Image (1600 x 600)" type="image" />
  </content>
  <content name="Site Map" action="" count="3" pageoverride="1" xmloverride="site-map.xml">
    <item name="Column" type="blob_html" />
  </content>
  <content name="Social Media Links" action="" count="1" pageoverride="1" xmloverride="social-media.xml">
    <item name="Contact Email" type="link" />
    <item name="Facebook" type="link" />
    <item name="Twitter" type="link" />
    <item name="Instagram" type="link" />
    <item name="YouTube" type="link" />
    <item name="Vimeo" type="link" />
    <item name="Linked In" type="link" />
    <item name="Pinterest" type="link" />
    <item name="Feed" type="link" />
  </content>
</root>

Save this file or files and upload config folder to the root HTML folder on the server for the site.

If this is the _default.xml file, we add the attribute default="layout.xml" to the <root> node. Then after we save page content on a page that calls this configuration page content file, we need to go to the server in the site's HTML directory into /xml/pagecontent/ and rename the page ID file (if the page ID of the page was 802, it would have created a file called 802.xml) to layout.xml. This will make sure that all the pages that pull page content from _default.xml (i.e. all sub pages that don't have a specific configuration file created for their page ID).

Setting Up The Layout File

Within the layout file, make sure page content is being called at the top. You should see this line of code:

<cfinclude template="#request.dir_globals#/qry_page_content_inheritance.cfm">

This gets the page content file that we created.

For each area that calls page content, reference the specific page content element as a cold fusion variable like this:
<cfoutput>#pcValue('pcItem_1_1_1')#</cfoutput>

To decipher this, pcItem stands for Page Content Item. The subsequent numbers reference specific levels of nodes and items within the page content file in descending order. 

The first number is the number in the list of content nodes. So you are referencing the fifth content node (or the fifth page content element in your list), you would put a 5 as the first number in the coldfusion variable.

The second number makes reference to the count or item list number you are referencing. Say you have a page content area that has a type="image" and a count="3". If you want to reference the third image in the list you would put a 3 as the second number in the coldfusion variable.

The third and final number is the actual item within the item list. Say you are setting up an image with a link and want to reference the link. You would want to reference the second <item> which would have a type="link". You would then make the third number in the cold fusion variable a 2.

pcValue

pcValue is a helper function that will give you the value for the pcItem that is passed to it, or a blank string. This prevents Coldfusion errors when an item doesn't exist for some reason. Example: <cfoutput>#pcValue('pcItem_1_1_1')#</cfoutput>

Example

If you are adding an updatable text area where the client can also update the background image, here's how you would set it up in the layout file:

<cfoutput>
     <cfif len(pcValue("pcItem_1_1_1"))>
          <div id="serviceTimes" style="background: url(#pcValue('pcItem_1_1_1')#) no-repeat;">#pcValue(pcItem_1_1_2)#</div>
     <cfelse>
          <div id="serviceTimes" style="background: url(/images/layouts/default.jpg) no-repeat;">Add text in page content</div>
     </cfif>
</cfoutput>

 

 

Saving Page Content

Not needed when using pcValue() for all Page Content variables

To save page content, you either need to not be calling page content in your layout file, or have anywhere you are calling page content commented out with cold fusion comments (i.e. <!---   comment   --->). This is because if we are calling page content before it has been saved, it will throw an error since we will be calling variables that do not exist yet.

Set up your configuration files (i.e. _default_743.xml, _default.xml, etc.) with your page content elements. Make sure you are getting page content in your layout file with:

<cfinclude template="#request.dir_globals#/qry_page_content_inheritance.cfm">

Make sure you have not called to page content variables or have them commented out, go to the site and in the Perpetua Menu, go to Page Properties > Page Content. The administration console should pop up where you can add your files, text, images, etc. to your page content areas.

Go into your layout file and either add your page content variables as explained in the previous step, or uncomment your existing page content areas.

Adding layout.xml

If this is page content calling from the _default.xml file, you should have had the attribute default="layout.xml" added to the <root> node of your configuration file. By saving on one of your sub pages, you have only created an xml file for that specific page ID. So, after you have saved, in order for your sub pages to use this default xml file that was created, you need to go to your site's HTML directory under /xml/pagecontent/ and rename the page ID xml file you created when you saved page content (i.e. 802.xml) to layout.xml. Since you added the default="layout.xml" attribute to the <root> node, it will read all the content in layout.xml. If you do not rename the file, it will not find any xml file called layout.xml or for it's specific page ID and will possibly throw an error.

 

Troubleshooting

Because of it's complexity, there will be issues involving page content. Here are some basic troubleshooting tips to try and solve the problem.

Clear Your Cache

Especially when having issues with flash not behaving properly. Web browsers like to cache swf files so they don't have to reload every time. 

Re-save Page Content

Also usually the problem if flash is the issue. Page content will not be updated unless you re-save it. Until you do, if you have made any changes to files it needs, it will be calling all it's content from an outdated xml file. It needs to be re-saved in order to rewrite the xml files and regenerate all flash elements.

Check Your Paths

Make sure you are referencing all the right paths in your Page Content variables. If you are referencing #pcItem_4_1_1# and there is only three content regions in your configuration file, it will throw an error. Look at the actual xml (/xml/pagecontent/#pageID#.xml) file that was created and trace all the nodes to make sure you are referencing the right numbers in your variables.

Make Sure You're Using The Right QRY

If you are using the newer page content variables (i.e. #pcItem_1_1_1#, #regionXmlLocation_1#, etc.) make sure your getting page content INHERITANCE (qry_page_content_inheritance.cfm) at the top of the layout file. If you are making an update or change to an older site it might be referencing page content variables in the old way (i.e. #request.xml_page.root.XmlChildren[3].XmlChildren[1].XmlChildren[1].XmlCdata#, #request.xml_page.root.XmlChildren[1]#, etc.) you may need to get the old page content (qry_page_content.cfm) at the top of the layout file.

View Page Source

If there is a page error, view the source of the page and it will usually give you a message saying something like a variable was undefined. This means that either you did not save page content yet and you are making reference to a variable in you layout file, or you are making reference to a variable that does not exist (a wrong node number).

Viewing the source will also help you determine that all your variables are being replaced with the right content. In all you Page Content areas, the variables you use to reference page content regions will be replaced in your page source with the data they are referencing. Your flash files should be generated with a time and date stamped .swf file, your links should be the actual links that were saved in page content, etc.

Comment Out Page Content

This is necessary if page content is throwing an error. The only way to view the page again is to get rid of the page content that is referencing variables that do not exist. Go in and double check page content is saved properly and that all variables are referenced properly.

Check The Configuration File

Double check the configuration file you created to add your page content regions (/config/xml/pagecontent/_default_#pageID#.xml), and make sure everything is named properly, that all your attributes are correct for the type of content is, etc.

Check The XML File

In the site's HTML directory go to /xml/pagecontent and view the Perpetua generated XML file (#pageID#.xml). This is the file that your variables in you layout file are referencing. Make sure that all the data you saved through Page Properties > Page Content is all being added and that all your files and attributes are correct for the type of content region they are in.

Pageoverride and XMLoverride