Morepagedata lets you set all kinds of predefined design elements per page without changing the template.
Morepagedata does all this by entering new variables into the page data. Usually your template has to be prepared accordingly or you may use a template with prepared Morepagedata definitions.
Update from 1 beta 3 to 1 beta 4
Keep the config folder and exchange the rest.
If you want to experiment with html files, add to config.php the lines
$plugin_cf['morepagedata']['path_html_files']="";
$plugin_cf['morepagedata']['path_html_files_start_from_content_folder']="";Update from version 1 beta 2 to version 1 beta 4
Keep your config folder as it is and install the new version over the old files. 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 preceeding '#'.
For 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.
New in 1 beta 3
- Template specific Morepagedata
Without entry in the "templates" field, your morepagedata will be availabe for every page. A comma separated list of templates will restrict the availability of morepagedata variables to these templates.- Templates can come with build-in Morepagedata definitions
These Templates come with the filemorepagedata.csv
in their main folder. If you have such templates, go to Plugin main of Morepagedata. The plugin will offer to import the prepared morepagedata. Press Import these definitions and the definitions will appear in the main variable table. You can rearrange the order of the variables by clicking on the arrow, add a
<hr>
(horizontal line) after a variable and change the displayed wordings.After import morepagedata variables are ready to be used on every page of the specified template.
Before removing the plugin delete all variables first, otherwise they remain in the page data.
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 predifined plugin calls are useful for the inexperienced user or for complicated calls. Plugins called this way will appear at the bottom of a page.
This allows the user to insert html files into the page.
A future use of this feature could be multi author websites, where different authors produce articles
and the admin inserts these articles via morepagedata on different pages.
However to produce these html files an additional solution is required
(which isn't part of morepagedata yet).
These files could be organized as follows:
Domain |__cmsimple |__content |__content.htm | |__html |__author-1 | |__article-1 | |__article-2 | |__article-3 | |__author-2 | |__article-1 | |__article-2 | |__article-3 | |__author-3 |__article-1 |__article-2 |__article-3In the page data tab a variable of the type "html_file" will generate two option lists on top of each other:
(1) First decide which aspects of your template you want to make changable.
(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 ($headimage
), the background color ($bgcolor
) and on some pages you need more content width ($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($bhcolor)) {
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.
In the plugin backend a click on + will open a new entry line. After entering and saving, the new 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.
<hr>
) to be dispayed after a field.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();}
?>
uses Jan Odvárko's jscolor.
It is preset to add #
to the color code, so that color names can also be entered.
presents an option list with all the images from a folder specified in plugin config.
provides free input, in case all other field types are too restricted.
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!
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<';} ?>
presents an option list with all the images of the templates folder. Path can be set in plugin config.
gives the possibility to put a little content into an prepared area of the template instead of using a newsbox. You can set in plugin config, whether the standard editor is used or not.
uses jQuery plugins cycle.lite and cycle.all by malsup, see http://jquery.malsup.com/cycle/
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.
If you use the slide show but don't specify any slide show effect, the much smaller cycle.lite version (8kb) will be loaded and the fade effect will be dispayed as soon as at least 2 images are selected.
If you specify an effect in plugin config or for a page, the larger (51kb) cycle.all version will be loaded. Available effects of this version are:
blindX — blindY — blindZ — cover — curtainX — curtainY — fade — fadeZoom — growX — growY — scrollUp — scrollDown — scrollLeft — scrollRight — scrollHorz — scrollVert — shuffle — slideX — slideY — toss — turnUp — turnDown — turnLeft — turnRight — uncoverq — wipe — zooms
Specify the path to the images in plugin config. Enter into your template code similar to this:
<?php
if(isset($NAME_OF_YOUR_VARIABLE)) {
echo '<div class="slideshow">'.slideShowImages($NAME_OF_YOUR_VARIABLE).'</div>';}
?>
A possible name for the variable is $slideshow
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;
}
To set different slide show effects per page the field of the type "slide_effect" is used.
Enter the name you give to this variable as second value into calling the slideshow in your template, e.g.:
<?php
if(isset($NAME_OF_YOUR_SLIDESHOW_VARIABLE)) {
echo '<div class="slideshow">'.slideShowImages($NAME_OF_YOUR_SLIDESHOW_VARIABLE, $NAME_OF_YOUR_SLIDESHOWEFFECT_VARIABLE).'</div>';}
?>
This field will present an option list with as default 27 effects. Often this is too much for the Webmaster and some effects may also not be useful in your case. The list can be edited in plugin config, e.g. for right aligned images a usefule list is:
blindX,blindY,blindZ,fade,scrollUp,scrollDown,scrollRight,scrollVert,toss,turnUp,turnDown
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.
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.
© 2013 by svasti
© 2013 for used json_decode and encode functions (to make morepagedata usable under php 4.3) by cmb