Splitting paragraph?

8 posts by 5 authors in: Forums > CMS Builder
Last Post: August 11, 2013   (RSS)

Hi Orazio,

You can insert variables anywhere in a text box using this technique.

This recipe example below is from my CMSB Cookbook http://www.thecmsbcookbook.com . It describes how to insert a variable called *school_name* into a block of text.

The variable can be named anything you’d like. In your case you might call it *adsense1* and place it between paragraph 3 and 4 of your text.

There are other examples for inserting variables in the full Cookbook recipe.

Hope it gets you started in the right direction.

Jerry Kornbluth
________________________________

INCLUDING VARIABLES IN THE CONTENTS OF A TEXT BOX

(Note: In this example, we're assuming that the values for the variable *school name* is in an editor called "school_record" and the text field is a field called "content" in a table called" your_table".)

The Text:

Welcome to the Online Student Log-in for the *school_name* This section of our website provides links...

You can then replace the variable *school_name* when you are outputting your content.

For a list page the code would be:

<?php echo str_replace('*school_name*',$schoolRecord['title'],$record['content']);?>

For a detail page the code would change to:

<?php echo str_replace('*school_name*',$schoolRecord['title'],$your_tableRecord['content']);?>

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Hi Orazio,

Jerry suggestion seems like the best solution. You could also have two separate WYSIWYG fields in your section, one for text that appears above the advert and a second box for text that appears below it. If these fields were called Top Text and Bottom Text, you could display them like this:

<?php echo $record['top_text']; ?>
<!-- adsense code goes here -->
<?php echo $record['bottom_text']; ?>

Let me know if you have any questions.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By Toledoh - August 5, 2013

It may take some figuring out, but maybe you could also use p:nth-child(4):before{ content"**placeholder**";} to enter something before the 4th paragraph.  Then, maybe something like http://www.benalman.com/projects/jquery-replacetext-plugin/ could then replace the placeholder?

Cheers,

Tim (toledoh.com.au)

By Codee - August 8, 2013

Tim, does that work in IE, pre version 9/10?

By Toledoh - August 8, 2013

Not sure. May need modernizr or something similar?

Cheers,

Tim (toledoh.com.au)

By Codee - August 8, 2013

Ok, thanks.

By Toledoh - August 11, 2013

Hey Equinox,

I found this... may help?

For non-IE6 browsers, you can use the adjacent sibling selector, if the type of child elements are always the same. For example, if you want select the 5th child li element in a list:

ul:first-child > li+li+li+li+li { ... }

Cheers,

Tim (toledoh.com.au)