Forums / Setup & design / include editable content in login page

include editable content in login page

Author Message

Chris Detmer

Wednesday 17 October 2007 7:36:07 am

I'm trying to figure out the best way to approach this:

I'm using version 3.9 and want to include a piece of content in my custom login page that content admins can access from the CMS. Right now I have hardcoded the content into login.tpl. I'm looking for a good way to manage future situations like this as well.

Should I setup a section or folder in the CMS dedicated to 'orphaned' bits of content that otherwise wouldn't belong to a visible section of the site?

Pascal Specht

Thursday 18 October 2007 7:18:41 am

Hi Chris,

I solved the problem by writing a template operator:

class myOperators
{
   /*!
    Constructor
   */

   function myOperators()
   {
       $this->Operators = array('bg_include_text' );
   }

   function &operatorList()
   {
       return $this->Operators;
   }

   function namedParameterPerOperator()
   {
       return true;
   }

   function namedParameterList()
   {
       return array(  'bg_include_text' => array( 'id' => array( 'type' => 'string',
                       'required' => true,
                       'default' => '' )
		   );
   }

   function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace,
                    &$currentNamespace, &$operatorValue, &$namedParameters )
   {
       switch ( $operatorName )
       {
           case 'bg_include_text':
           {
               $operatorValue = $this->bg_include_text( 																										$namedParameters['id']
												);
           } break;
       }
   }

   function bg_include_text( $id )
   {

			/* tries to fetch a text that has been put in common_ini_settings under that name */

			$classID = eZContentObjectTreeNode::classIDByIdentifier( 'common_ini_settings' );
			$chosenNodeList    = eZContentObject::fetchFilteredList( array( 'contentclass_id' => $classID ), 0, 1 );
			$chosenNode = $chosenNodeList[0];
			$dataMap = $chosenNode->dataMap();
			$key="".$id.""; // string conversion
		    $operatorValue= $dataMap[$key]->content();
			
	   return $operatorValue;
   }



   /// privatesection

   var $Operators;
}
?>

In the admin interface, I add attributes (of type text-line) to the class definition of COMMON INI SETTINGS, and then, the user can edit the common ini settings and fill them with whatever text.

for example, I created an attribute tac_url which is the URL of the terms and conditions... the template uses then {let tac_url = bg_include_text(tac_url)} to retrieve the URL into the variable.

{let tac_url = bg_include_text(tac_url)}

Let me know if this is clear enough or if you need more details!

Cheers,

</Pascal>

Chris Detmer

Thursday 18 October 2007 8:16:34 am

Thanks Pascal. I'll give this a try. I'll reply if/when I need more specifics.

- Chris

eZ debug

Timing: Jan 19 2025 11:49:26
Script start
Timing: Jan 19 2025 11:49:26
Module start 'content'
Timing: Jan 19 2025 11:49:26
Module end 'content'
Timing: Jan 19 2025 11:49:26
Script end

Main resources:

Total runtime0.2256 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 589.0703180.8281
Module start 'content' 0.00580.0046 769.898497.9297
Module end 'content' 0.01040.2150 867.8281526.2031
Script end 0.2255  1,394.0313 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00371.6540200.0002
Check MTime0.00140.6250200.0001
Mysql Total
Database connection0.00060.277010.0006
Mysqli_queries0.179379.51181410.0013
Looping result0.00170.75161390.0000
Template Total0.214795.210.2147
Template load0.00070.309510.0007
Template processing0.214094.862510.2140
Override
Cache load0.00050.222110.0005
Sytem overhead
Fetch class attribute can translate value0.00090.389610.0009
XML
Image XML parsing0.00030.125910.0003
General
dbfile0.00200.8850200.0001
String conversion0.00000.003730.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs