help with plugins and integration

6 posts by 2 authors in: Forums > CMS Builder
Last Post: August 27, 2010   (RSS)

By moh3 - August 26, 2010

hello to all,

can some one direct me in the right direction i'm trying to integrate a newsletter and form builder with cms builder

1-the idea is i want to add a link to the news letter app inside the admin interface.
2- i want to use the security and session of the admin interface with my newsletter app

is there a guide on how to create a plugin or at least a list of required information to create a plugin.

i have a question about the documentation and are willing to update it as there a lot of functionally not mentioned in the docs

i know is post is long but i need this information:
can i predfine a layout template to be used say with a multi record section where the user will be able to choose a template that goes with a certain record

Re: [moh3] help with plugins and integration

By Chris - August 26, 2010

Hi moh3,

As of yet, we don't have any documentation on creating plugins. However, we do have unobfuscated source code and a couple of free plugins which you can take a look at to figure out how they work and how you can write your own. Searching the CMSB source code for "doAction(" and "applyFilters(" is probably the best way to learn how to make a plugin.


2- i want to use the security and session of the admin interface with my newsletter app


Our Website Membership plugin allows you to use the security and session of the CMSB admin interface on your public website. You might consider looking into how that works.


can i predfine a layout template to be used say with a multi record section where the user will be able to choose a template that goes with a certain record


I'm not sure exactly what you mean here. A section could certainly have a list/text field which could be used to select a "template", but I'm not sure how this layout template will be used. Are you refering to a template in the CMS Builder admin interface or on your website?
All the best,
Chris

Re: [chris] help with plugins and integration

By moh3 - August 26, 2010

dear chris

when i'm talking about templates i mean a site template to give each web page a different design depending on it's section can you please help with that.

i also asked about using same login info and session in order to integrate by news letter managment script with cms builder admin interface not the public site is there a code snippet that i could use for protecting my newsletter app using cms builder security,as for membership plugin i already have that,but the idea is to add additional functionalty to be part of my cms builder admin,i hope i'm clear

regards

Re: [moh3] help with plugins and integration

By Chris - August 27, 2010

Hi moh3,

You can use PHP if statements to choose which template to use based upon some field in the record you're displaying. In the example below, the section is called "foo" and it has a list field called "template" with three options: "red", "blue", and "green". STEP ONE is unchanged, but I left it in to show you what the entire script would look like:

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php


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

// load records
list($fooRecords, $fooMetaData) = getRecords(array(
'tableName' => 'foo',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$fooRecord = @$fooRecords[0]; // get first record

// show error message if no matching record is found
if (!$fooRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}

?>
<?php
if ($fooRecord['template'] == 'red') { include 'templates/red.php'; }
if ($fooRecord['template'] == 'blue') { include 'templates/blue.php'; }
if ($fooRecord['template'] == 'green') { include 'templates/green.php'; }
?>


Does that help?

i also asked about using same login info and session in order to integrate by news letter managment script with cms builder admin interface not the public site is there a code snippet that i could use for protecting my newsletter app using cms builder security,as for membership plugin i already have that,but the idea is to add additional functionalty to be part of my cms builder admin,i hope i'm clear


I think you could protect your script in the exact same way you'd protect a page on your public site. Is there a reason this wouldn't work?

There's an example of how to do this in the Website Membership readme.txt under the heading "MAKING PAGES LOGIN ONLY".

I hope this helps! Please let me know if you have any questions.
All the best,
Chris

Re: [moh3] help with plugins and integration

By Chris - August 27, 2010 - edited: August 27, 2010

Hi moh3,

can i organize multi records in hierarchy way say record1 is parent of record2


Try out Category Menus, they provide exactly this functionality. You can find them under <Advanced Menus> when creating a new section.

what about managing website links and navigation how can i control navigation links from the admin without hardcoding any website links...


You can use a Multi Record or Category Menu section to drive all or part of your navigation links. You'll probably want to put the code for generating these in an include and disable the 'allowSearch' option to getRecords() for them.

You'll probably want to set up your CMS so that your client will be adding new records but not new sections. There are a lot of clever ways that you can drive all kinds of website features with records! :)

If you can describe how you want the site set up and what the navigation should link to, we can probably offer suggestions on how to structure your sections and how to build your navigation.

I hope this helps. Please let me know if you have any questions.
All the best,
Chris