Join two records

8 posts by 3 authors in: Forums > CMS Builder
Last Post: October 29, 2008   (RSS)

By grauchut - October 27, 2008

Is there a way two have two records join together. Looking at this site. http://www.palmyrafire.com is there a way to have the date then a "-" then content on one line with out a space between the two. meaning date is on top and content is below. Thanks Glenn
Glenn Rauchut (Owner) Emergency Designz

Re: [grauchut] Join two records

By _kate_ - October 27, 2008

Hi Glenn,
This would be very simple to do using CMSB assuming you make the date and the content a separate record. The fields in a section will be connected to the other data in that section, so you simply need to make a new section and add the required fields (date, content) and any other info you want connected to this data.

CMSB has some preset Menu Editors, one of which is a Blog which would be very similar to what you are trying to do, if you are looking to create a news type feed like on that site.

When you are laying out the code for your page, put the date on one line, use a break tag and then use the content tag. So for example if you were to use the default Blog section, you could display the date and content using the following:

<?php echo date("D, M jS, Y g:i:s a", strtotime($record['date'])) ?>
<br/>
<?php echo $record['content'] ?>


If you are able to provide some more specific details on exactly what you are trying to do I can give you some clear instructions on what code to use.

If you have any further questions please don't hesitate to ask :)

Re: [_kate_] Join two records

By grauchut - October 27, 2008

Thanks for the quick response. Here is what I am looking to do. Example:
Tue, Jan 1st, 2008, 1:00 am - content etc etc etc etc

Currently it displays like this

Tue, Jan 1st, 2008, 1:00 am

content etc etc etc etc

I want both to be on one line.
Glenn Rauchut (Owner) Emergency Designz

Re: [grauchut] Join two records

By Dave - October 27, 2008

Hi Glenn,

Is the content field a wysiwyg? And what is the code you're currently using to display those two fields?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Join two records

By grauchut - October 27, 2008

yes the content field is a wysiwyg

here are the codes

[font "Verdana"]<?php echo date("D, M jS, Y g:i:s a", strtotime($record['date'])) ?>

<?php echo $record['content'] ?>

Glenn Rauchut (Owner) Emergency Designz

Re: [grauchut] Join two records

By _kate_ - October 27, 2008 - edited: October 27, 2008

Hi Glenn,
The WSYIWYG field is the problem as it automatically wraps the content in a <p> tag.

You can easily solve this by using a text box instead for the content. If you need to use the WYSIWYG field, then have a look at the threads below discussing the same problem - hopefully some of the solutions will be helpful for you :)

http://www.interactivetools.com/iforum/forum.cgi?post=61790
http://www.interactivetools.com/forum/gforum.cgi?post=63416

Re: [grauchut] Join two records

By Dave - October 28, 2008

Try this one:

<?php echo date("D, M jS, Y g:i:s a", strtotime($record['date'])) ?>

<!-- remove leading <p>, do this _before_ displaying field value -->
<?php $record['content'] = preg_replace("/^\s*<p>/i", "", $record['content'] ); ?>
<?php echo $record['content'] ?>
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Join two records

By grauchut - October 29, 2008

Dave,

Works great, Thanks for to the both of you for your quick response and help.
Glenn Rauchut (Owner) Emergency Designz