Morepagedata_XH 1.2.2

for CMSimple_XH
1.5.3 or higher

Morepagedata lets you set predefined design elements per page without changing the template.

Morepagedata does all this by entering new variables into the page data. Except for predefined plugin calls, your template has to be prepared accordingly.

Note: Before entering variables it is advisable to clean up the pagedata via the CMSimple_XH standard function.


New in version 1.2

Ready for php 7 and XH 1.7.

New in version 1.1

Small bugfix and improved backend layout. The slideshow variable can be used to drive an external slide show plugin when the internal slide show is switched off. The internal slideshow can take a default image list. For website visitors without java script only the first image will be shown.

New in 1.0

Textarea, slide show effect, html file entry are gone. If you use these effects don't upgrade. Version 1.0 is only a cleaned up version 1 beta 4. New: input_field has become an auto growing textarea.

Update from 1.0, 1 beta 3 / beta 4

Install everything on top of the old plugin. Re-enter your settings in the config.php. Your old data will be kept, because the download comes without data file. Delete files/folders form the beta versions:

  • file: plugins/morepagedata/texter.php
  • folder: plugins/morepagedata/jquery
  • folder: plugins/morepagedata/jscolor
  • folder: plugins/morepagedata/test

Go to the plugin backend and save, because the new variable "br" must be set. "br" (break) adds an empty line after a variable in pagedata view, this was standard, now ist is selectable. So if you want to keep the old look, check all "br"s.

Update from 1 beta 2

Proceed as above and go to the plugin backend and you will find that you can "import" your old settings. Click on "import" and you are done.

Some change may be needed in the templates as the color picker will now produce values with preceding '#'.

Updates from alpha versions

Open config/config2.php with an editor and change all "," to ";". Then proceed as above. You may have to change paths in your template as image paths now start at the site root and template image paths start at the template folder.


Removing Morepagedata plugin

Before removing the plugin delete all variables first, otherwise they remain in the page data.


Preparing templates for morepagedata

General procedure

(1) First decide which aspects of your template you want to make changeable.
(2) Then prepare your template accordingly with some new php-variables.

If you want to change css-values with morepagedata, it is practical to do this in the html head of the template.

Example: You want to introduce 3 new variables to control the head image (e.g.: $headimage), the background color (e.g.: $bgcolor) and on some pages you need more content width (e.g.: $width). Add the following css-code just before the end of the head section </head>:
<style type="text/css"><?php // here the css-definition is called, and php will generate it if(isset($headimage)) { // i.e.: if a $headimage value has been entered via page data tab, do this echo '#head {background-image:url(' . $pth['folder']['template'] . $plugin_cf['morepagedata']['path_template_images'] . $headimage . ');}'; } if(isset($bgcolor)) { echo '#body {background-color:'.$bgcolor.';}'; } if(isset($width)) { // $width in this example is type "checkbox", so its value is only on (=set) or off echo '#content {width:650px;}'; } ?></style>
Note: The path to the template background images is
$pth['folder']['template'] . $plugin_cf['morepagedata']['path_template_images']

What cannot be done in css, like changing images or slide shows, is usually written into the body section of the template, e.g. for an image: <?php if(isset($myphoto)) { echo '<img src="' . $plugin_cf['morepagedata']['path_image_folder'] . $myphoto . '">';} ?>
(The path is set in plugin config starting from the base URL of the site)
or for the slideshow: <?php if(isset($slideshow) && !$edit) { echo '<div class="slideshow">'.slideShowImages($slideshow).'</div>';} ?>
(The slide show will not be visible in edit mode in this example because of the addition of && !$edit in the code.)

(3) Finally enter these new variables as new fields in Morepagedata plugin main settings. Morepagedata will check if these new variables are already in use by the system. If this is the case, you should give your variable in the template a different name and try again to enter it.

After entering and saving a new variable in the plugin backend, the variable will be added to the page data and changing the variable will be disabled. You can however delete it, which will delete the variable in page data as well.


Available field types

Checkbox

Can switch something predefined on or off, like in the above example where the width is set via checkbox to wide. Another example, switching the log in form of memberpages on or off: <?php if(isset($memberslogin)) {echo memberslogin();} ?>


Color picker

uses Jan Odvárko's jscolor. It is preset to add # to the color code, so that color names can also be entered.


Image folder

presents an option list with all the images from a folder specified in plugin config.


Input field

provides an auto growing text area for free input, in case all other field types are too restricted.


Option list

On selecting this type an additional line will appear in plugin backend for entering the options as either
option 1||option 2||option 3 or
option 1|shown_text 1|option 2|shown text 2|option 3|shown text 3 etc.
No | at the end!


Plugin call

Via the option list in the plugin backend you can define a plugin call. Enter the plugin call without preceding {{{PLUGIN: and following ;}}}, e.g. you may enter quoteoftheday(). Add a | and enter the text which the user will see in the option list to select this option (e.g. quoteoftheday()|Quote of the Day).
After another | you can enter the next plugin option followed by | and text.
These predefined plugin calls are useful for the inexperienced user or for complicated calls. Plugins called this way will appear at the bottom of a page.


Select hiddenpages

gives an option list with all hidden pages to facilitate selection of the contents of a newsbox. The code using the variable $news could be in the template:
<?php if (isset($news)){echo '<div>'.newsbox($news).'</div>';} else{echo '<div>'.newsbox('News').'</div>';} ?>

An example for newsboxes with a styled div around them:
<?php if (isset($news)):?> <div class="news"> <div class="newsin"> <?php echo newsbox($news);?> <div style="clear: both;"></div> </div> </div> <?php else:?> <div class="news"> <div class="newsin"> <?php echo newsbox('News');?> <div style="clear: both;"></div> </div> </div> <?php endif;?>


Template image

presents an option list with all the images of the templates folder. Path can be set in plugin config.


Slide show

uses the jQuery plugin cycle.lite by malsup. The fade effect will be displayed as soon as at least 2 images are selected. The jQuery plugin will only be loaded, when the slide show is used. So if you don't want the slide show, the plugin will not load it.

Putting the slide show into the template

Specify the path to the images in plugin config. If your variable is $slideshow enter into your template some code similar to this:
<?php if(isset($slideshow)) { echo '<div class="slideshow">'.slideShowImages($slideshow).'</div>';} ?>

In order to be able to center or right align the images (default = left aligned), all the images are wrapped into a <div> by morepagedata. The resulting source code will be something like: <div class="slideshow"> <div><img src="./images/image1.jpg" ></div> <div><img src="./images/image2.jpg" ></div> </div>

Css example for centered or right aligned images: /* ============= Slideshow ============= */ .slideshow { float:right; width:350px; height:300px; margin-left:10px; } .slideshow div { width:350px; height:300px; overflow: hidden; } .slideshow div img { margin: 0 0 0 auto; /* this line for right aligned images */ margin: auto; /* or this line for centered images */ display:block; }


Adding help text as tool tip

The extra line for help text can switched on or off for all variables in plugin backend. For color picker and slide show a prepared help text from the language file will be used automatically and no extra help text has to be entered.


Creating a morepagedata.csv for your template

If you want to give your template to others, you may want to add a morepagedata.csv to it, so that other users can easily use the morepagedata. Create a new file named morepagedata.csv and enter your variables line by line this way:

var=Name of your variable;display=What should be displayed in the page data field;type=Type of your variable [;options=for option list, enter the options here as: option1|text1|option2|text2|option3|text3 or option1||option2||option3 ][;help=for tooltip enter the text here]

Code between [] is optional. The order of the entries is free. Put this file into the main folder of your template.