<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.creativecommons.org/index.php?action=history&amp;feed=atom&amp;title=Cchost%2Fdeveloper%2FHooking_Page_Render</id>
		<title>Cchost/developer/Hooking Page Render - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.creativecommons.org/index.php?action=history&amp;feed=atom&amp;title=Cchost%2Fdeveloper%2FHooking_Page_Render"/>
		<link rel="alternate" type="text/html" href="https://wiki.creativecommons.org/index.php?title=Cchost/developer/Hooking_Page_Render&amp;action=history"/>
		<updated>2026-05-05T23:11:07Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https://wiki.creativecommons.org/index.php?title=Cchost/developer/Hooking_Page_Render&amp;diff=19728&amp;oldid=prev</id>
		<title>Fourstones: New page: Category:ccHost Category:ccMixter Category:Developer Category:Software Category:Technology {{cchost_head}} {{lowercase}} Page rendering happens in 2 main phases in the ...</title>
		<link rel="alternate" type="text/html" href="https://wiki.creativecommons.org/index.php?title=Cchost/developer/Hooking_Page_Render&amp;diff=19728&amp;oldid=prev"/>
				<updated>2008-11-12T10:49:33Z</updated>
		
		<summary type="html">&lt;p&gt;New page: &lt;a href=&quot;/wiki/Category:CcHost&quot; title=&quot;Category:CcHost&quot;&gt;Category:ccHost&lt;/a&gt; &lt;a href=&quot;/wiki/Category:CcMixter&quot; title=&quot;Category:CcMixter&quot;&gt;Category:ccMixter&lt;/a&gt; &lt;a href=&quot;/wiki/Category:Developer&quot; title=&quot;Category:Developer&quot;&gt;Category:Developer&lt;/a&gt; &lt;a href=&quot;/wiki/Category:Software&quot; title=&quot;Category:Software&quot;&gt;Category:Software&lt;/a&gt; &lt;a href=&quot;/wiki/Category:Technology&quot; title=&quot;Category:Technology&quot;&gt;Category:Technology&lt;/a&gt; {{cchost_head}} {{lowercase}} Page rendering happens in 2 main phases in the ...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:ccHost]]&lt;br /&gt;
[[Category:ccMixter]]&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Technology]]&lt;br /&gt;
{{cchost_head}}&lt;br /&gt;
{{lowercase}}&lt;br /&gt;
Page rendering happens in 2 main phases in the CCPage class. In Phase 1 all the variables are gathered into a huge variable array. In Phase 2 CCPage calls down to it's base class, CCSkin, to merge the variables with the config-selected page template.&lt;br /&gt;
&lt;br /&gt;
Right before Phase 2 happens, CCPage triggers an event to let any custom code prepare any last minute hacks before handing off to the template engine (CCSkin).&lt;br /&gt;
&lt;br /&gt;
If you create a module that hooks that event you can manipulate the variables (er, hack at the array) to change the appearance of any/all pages.&lt;br /&gt;
&lt;br /&gt;
An example: (put the following code with a PHP extension into your '''&amp;lt;local_files&amp;gt;/lib''' directory):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  CCEvents::AddHandler(CC_EVENT_RENDER_PAGE,  'page_trapper' );&lt;br /&gt;
 &lt;br /&gt;
  function page_trapper( &amp;amp;$page )&lt;br /&gt;
  {&lt;br /&gt;
     // This might be an array (I think)&lt;br /&gt;
     $caption =&amp;amp; $page-&amp;gt;vars['page-caption'];&lt;br /&gt;
 &lt;br /&gt;
     // same with this&lt;br /&gt;
     $title =&amp;amp; $page-&amp;gt;vars['page-title'];&lt;br /&gt;
 &lt;br /&gt;
     $caption = 'CAP: ' . $caption;&lt;br /&gt;
     $title = 'TITLE: ' . $title;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
The code above will simply append strings to the caption and title to every page in the system. If you are looking for a specific page you can for that page's title (e.g. 'str_file_deleting').&lt;br /&gt;
&lt;br /&gt;
Of course your hacks are not limited to these variables. You can also, say, remove the bread crumbs from specific page by simply null-ing out the 'bread_crumbs' var:&lt;br /&gt;
&lt;br /&gt;
  CCEvents::AddHandler(CC_EVENT_RENDER_PAGE,  'page_trapper' );&lt;br /&gt;
 &lt;br /&gt;
  function page_trapper( &amp;amp;$page )&lt;br /&gt;
  {&lt;br /&gt;
     $title =&amp;amp; $page-&amp;gt;vars['page-title'];&lt;br /&gt;
 &lt;br /&gt;
     if( $title == 'str_file_deleting' )&lt;br /&gt;
     {&lt;br /&gt;
        unset( $page-&amp;gt;vars['bread_crumbs'] );&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
In order to get a full idea of what variables are available you can inspect the page object:&lt;br /&gt;
&lt;br /&gt;
   CCDebug::Enable(true);&lt;br /&gt;
   CCDebug::PrintVar($page);&lt;br /&gt;
&lt;br /&gt;
And don't forget about [[Cchost/guide/Troubleshooting#Variable_Dumps|variable dumps]].&lt;/div&gt;</summary>
		<author><name>Fourstones</name></author>	</entry>

	</feed>