Adding Individual Sidebar boxes/features

13 posts by 4 authors in: Forums > CMS Builder
Last Post: April 18, 2011   (RSS)

Re: [csdesign] Adding Individual Sidebar boxes/features

By Toledoh - March 12, 2011

Hi Tina.

I've done a similar thing to what I think you are doing (no screenshot).

I used a multi-record section to add "snippets" which consisted of title, text and image. I then randomly ('orderBy' => 'RAND()') display 4 of these records on a page.
Cheers,

Tim (toledoh.com.au)

Re: [csdesign] Adding Individual Sidebar boxes/features

By Damon - March 15, 2011

Hi Tina,

The screenshot didn't get attached. Can you try adding it again so I have a better idea what you are trying to setup?

Thanks!
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Damon] Adding Individual Sidebar boxes/features

By csdesign - March 15, 2011

sorry about that - must have gotten click happy!
Attachments:

picture-53.png 68K

Re: [csdesign] Adding Individual Sidebar boxes/features

By Jason - March 16, 2011

Hi Tina,

I think Tim definitely has the right idea. Have a multi-record section where you create 1 record for each "box" you want to display. When you're retrieving those records from the database, you can use code like this:

list($sideBarRecords, $sideBarMetaData) = getRecords(array(
'tableName' => 'sidebar',
'allowSearch' => false,
'limit' => 4,
'orderBy' => "RAND()",
));


Hope this helps get you started.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Adding Individual Sidebar boxes/features

By csdesign - March 16, 2011

Thanks guys! I'll try that out!

Re: [Jason] Adding Individual Sidebar boxes/features

By csdesign - April 4, 2011

The code worked great! Thank you!

Is it possible to add two more variations of the sidebar box layout to be included in the random display.

For example, right now all of the boxes use "boxList.php" and it's a simple title, subtitle & content display.

I would like to have to two additional box layouts that would display randomly in the mix with the first set. I've
already set those up as two single records: box2 and box3

For example:

• box2 would display 2 random testimonials automatically pulled from the testimonials page (patient_testimonialsRecords)
• box3 would be a small photo gallery using a js slideshow script

Essentially they will each have the same setup (title, subtitle & content area - testimonials & js slideshow)


I've attached a screenshot of what I have now. I'm assuming I can't just add another version of the box
layout in boxList.php but that I have to have new layouts (boxList2.php & boxList3.php).

I hope that all made sense. Thank you!! Tina


CURRENT CODE: (stripped down) =====================
<?php


// load records
list($boxRecords, $boxMetaData) = getRecords(array(
'tableName' => 'box',
'allowSearch' => false,
'limit' => '3',
'orderBy' => 'RAND()',
));

?>

<?php foreach ($boxRecords as $record): ?>
<?php echo $record['title'] ?>
<?php echo $record['subtitle'] ?
<?php echo $record['content'] ?

<?php endforeach ?>
<?php if (!$boxRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
Attachments:

picture-10_001.png 112K

Re: [csdesign] Adding Individual Sidebar boxes/features

By Jason - April 5, 2011

Hi Tina,

I'm not sure I understand where you're running into difficulty. You can pretty much use the same code to get your 2 random testimonials. Assuming that your tablename is testimonials, you could use something like this:

// load records
list($boxRecords, $boxMetaData) = getRecords(array(
'tableName' => 'testimonial',
'allowSearch' => false,
'limit' => 2,
'orderBy' => 'RAND()',
));


Exactly how we'd create your slideshow would depend a lot on which slideshow script your using. If you need us to integrate this in for you, that is something we could do through our consulting service. If you interested in looking into some options for that, please email consulting@interactivetools.com.

Hope this helps get you started. Please let me know if you have any other questions.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Adding Individual Sidebar boxes/features

By csdesign - April 5, 2011

Hi Jason,

I'm sorry, I don't think I explained it very well. I think my confusion lies with having 6 "boxes" that I want to come up in the sidebar (3 of which are displayed randomly) and I wasn't sure how to go about setting it up since 4 are text only, one is pulling in testimonials and one is a slideshow gallery.

I'll go ahead and jump into it and see what I can accomplish. Thanks!! Tina

Re: [csdesign] Adding Individual Sidebar boxes/features

By csdesign - April 14, 2011

Hi Jason,

I have all 3 types of boxes created now:

slideshow box (1) = boxList3.php
random testimonials box (1) = boxList2.php
general text boxes (4) - boxList1.php

What I would like to achieve, but I'm not sure it's possible, is to have 3 of the 6 boxes display randomly in the sidebar. I was able to setup a random display for the 4 general text boxes, but since the slideshow and testimonials are setup in their own php files, I'm not sure how to get them ALL to work together.

Here's my working page for testing and the code used.

http://www.nwsc5872139.myutilitydomain.com/news.php

<?php include "boxList3.php"; ?>
<?php include "boxList2.php"; ?>
<?php include "boxList.php"; ?>

Is it possible to get the boxList3 and boxList2 to work with the boxList in the sidebar? (display max of 3 random boxes in the sidebar)

I hope that makes sense.

Thank you! Tina