THE MODIFY HOME PAGE PLUGIN - Dec 29th, 2018


This is a great little plugin created by Chris Waddell at Interactive Tools. It allows you to easily add a heading and a
"quick pick" list to the page that a user sees (in addition to the usual navigation menu) when they first log on to CMS
Builder.

To customize the plugin and make it ready fro implementation, you'll want to change some things and remove a few lines
in the code.

First, find the list:


<ul>
<li><a href="?menu=news&action=add">Add a News Item</a></li>
<li><a href="?menu=jobs&action=add">Add a Job Listing</a></li>
<li><a href="?menu=events&action=add">Add an Event</a></li>
</ul>


This needs to be modified to reflect the tasks and editors that are appropriate for your site.

So you might change:


<li><a href="?menu=news&action=add">Add a News Item</a></li>


to:


<li><a href="?menu=projects&action=add">Add a project to your "project" list</a></li>


You can add as many items as you like.

The items in the list could also be links to external sites. (don't forget the http:// )


<li><a href="http://www.yoursite.com">Visit my web site</a></li>


You'll also want to change the "To modify this title, find and change this text in the Modify Homepage plugin!", that's
used as a title for the page to something more appropriate, or remove the text altogether.

You'll also want to remove the:


<p><strong>To modify this content, find and change this text in the Modify Homepage plugin.</strong></p>


If you get adventurous, you can change the items (or the entire list) to show only for specific users classes.

Add some check boxes to your user accounts section and call them similarly to the way the plugin checks for admin
status:


<?php if ($CURRENT_USER['isAdmin']): ?>
<p><b>Administrators:</b> Use the <a href="?menu=database">Section Editors</a> to add sections and generate PHP
viewers.</p>
<?php endif ?>


For example, you might create a check box field called "project" and use this code to display some code only if the
check box is checked :


<?php if ($CURRENT_USER['project'] == 1): ?>
Some code...
<?php endif ?>


Tim Forrest from Toledoh Enterprises suggested adding a frame to display the free Pixlr image editor as part of the
page.


<iframe id="pixlr" type="text/html" width="100%" height="600" src="http://pixlr.com/express/" frameborder="0"></iframe>


I love the idea, but preferred to make it a link at the bottom of my list, by adding:


<br />
<li><a href="http://pixlr.com/express/" target="_blank">Quickly crop or edit an image using the free Pixlr Express
image editor</a></li>


To further customize this plugin, you might want to pull data directly from a CMSB Section editor.

I set up a single record editor called "Quick Start Guide" with fields for "guide" information, and "resources". I
wanted to show that information on the CMSB Interface's "Home Page" as well as in a separate viewer that could be
accessed at all times.

Here's How I did that:

After the code


function modifyHomepage_content() {
global $CURRENT_USER;
?>
__


I added a standard // load viewer library call


$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/path_to_your_server/','','../','../../','../../../','../../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }
__


Then I added the get records call


<?php
// load records
list($quick_start_guideRecords, $quick_start_guideMetaData) = getRecords(array(
'tableName' => 'quick_start_guide',

'limit' => '1',
));
$quick_start_guideRecord = @$quick_start_guideRecords[0]; // get first record

?>
__


Then I added the code required to display my data.


<span class=" heading-text-bold">Welcome <?php echo mysql_escape($CURRENT_USER['first_name']); ?> <?php echo
mysql_escape($CURRENT_USER['last_name']); ?>,</span>
<?php

// load records
list($quick_start_guideRecords, $quick_start_guideMetaData) = getRecords(array(
'tableName' => 'quick_start_guide',

'limit' => '1',
));
$quick_start_guideRecord = @$quick_start_guideRecords[0]; // get first record

?>
<span class="medium"><?php echo $quick_start_guideRecord['guide'] ?><?php echo $quick_start_guideRecord['resources']
?></span>

<?php endif ?>
<span class=" medium">


<a href="http://your_web_URL/listing.php" target="_blank"><b>Click To View All Of Your Records</b></a>


<b>This &quot;Quick Start Guide&quot; will always be available from the link on the menu on the left side of your
screen.</b></span>


I enabled a plugin called exampleHeaderLinks to add the link to my Quick Start Guide to the menu on the left side of the
CMSB Interface.

You can download a copy of that plugin from:

http://www.thecmsbcookbook.com/downloads/exampleHeaderLinks.zip



The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact Interactive Tools for information on the downloading of the software or the purchasing of licenses.


Terms of Service