Need dynamic include list for sidebar

4 posts by 2 authors in: Forums > CMS Builder
Last Post: April 16, 2013   (RSS)

By rconring - April 16, 2013

Hello All ...

I am about to embark on a quest to solve a situation that has been annoying me since I began using CMSB and PHP!

I make extensive use of PHP includes since I have always done modular programming in any other dev language I have ever used.  I have been using that approach with all the sites I develop with CMSB and it all works great.  What I have wanted to do forever is to develop a way for the end user to pick and choose the include modules to display in the sidebar of any page and sort them so they render in a desired order.

For instance, here is the code for a page sidebar:

    <!-- Content Right -->
    <div class="content-right">
      <?php include('includes/map-inc.php'); ?>
      <?php include('includes/contact-inc.php'); ?>
      <?php include('includes/bulletins-inc.php'); ?>
      <?php include('includes/liturgies-inc.php'); ?>
    </div>             
    <!-- end, content right -->

Since each page on the site is referenced using the category number at end of URL, I was thinking I could place the list of available modules in a list within the category menu (navigation) since that data is available on every page but haven't quite figured out how to sort the module list for display sequence.

Has anyone done this sort of thing with CMSB ... dynamic includes?  I just thought I would run this by the forum before I start a google quest!  Any advice would be appreciated.  BTW, here is the way the code renders as it is: http://stmarymassillon.com

Ron Conring
Conring Automation Services
----------------------------------------
Software for Business and Industry Since 1987

By Toledoh - April 16, 2013

Hey Ron.

I create various "includes" such as _include_contact.php. _include_news.php etc.

Then, for each content page of the site, I may have a select list with options;

contact|Contact Us

news|Latest News

etc

Then in the code for the page: if select = contact, then include _include_contact.php

Each page may have room for 3 includes in the side content, so I create 3 select boxes - this way they choose the order.

There's probably better (more efficient) ways - but this works for me.

Cheers

Cheers,

Tim (toledoh.com.au)

By Toledoh - April 16, 2013

Hey Ron,

I've had some custom stuff done by iTools that allows me to select "people" from a table to display in a that page (department) and then, from within the editor of that page, have the click and drag ordering in the related field.  It's magic to behold!  skype me (tim at toledoh dot com dot au) if you want to see, but the site's not live as yet so I can't send a link.

Cheers,

Tim (toledoh.com.au)