Share » Forums » Setup & design » include editable content in login page

include editable content in login page

include editable content in login page

Wednesday 17 October 2007 7:36:07 am - 2 replies

Author Message

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

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu