Shor intro on Homepage, Full intro on about us page

5 posts by 3 authors in: Forums > CMS Builder
Last Post: November 28, 2011   (RSS)

By jacgo - November 27, 2011

Hi, there

My about us page is "about_usDetail.php"
I would like have 4-5 lines shor about us content on Homepage "index.php"

When click "more detail..."
User can go "about_usDetail.php" for full information.

1) How to do the above issue?
2) Can I choose which paragraph for Homepage?

Thanks for help!

Jacgo

Re: [jacgo] Shor intro on Homepage, Full intro on about us page

By gkornbluth - November 27, 2011 - edited: November 27, 2011

Hi Jacgo.

It's pretty easy using a something called a function on your home page.

Here's a portion of a recipe from my on-line CMSB Cookbook http://www.thecmsbcookbook.com that describes the code you'll need and how to implement it.

Hope it helps,

Jerry Kornbluth

MAXWORDS - LIMITING THE NUMBER OF WORDS SHOWN ON A PAGE

NOTE: You'll have to load the table required (your about page) with a load records call at the top of your home page, and if your about page is a single record editor, you'll have to change the occurrences of $record in the example to $your_about_page_tableRecord.

If you use the character limiting function that’s exactly what you’ll get, and words can be cut off. But if you want to limit the word
count, Dave Edis from Interactive Tools shares his usual uncanny wisdom:

Insert this function at the top of your page, or before you want to invoke the word limiting function:

<?PHP
function maxWords($textOrHtml, $maxWords) {
$text = strip_tags($textOrHtml);
$words = preg_split("/\s+/", $text, $maxWords+1);
if (count($words) > $maxWords) { unset($words[$maxWords]); }
$output = join(' ', $words);

return $output;
}
?>


Then put this code where you want the words limited to 5 words in this example:
<?PHP echo maxWords($record['content'], 5);
?>

If you want to add ...more and a link, use something like this:
<?PHP echo maxWords($record['content'], 5);
?>...<a href="<?php echo $record['_link']; ?>”>Read More</a>


or

<?PHP echo maxWords($record['content'], 5);
?>...<a class="read-more" href="http://www.your_site.com/your_detail_page.php?<?php echo $record['num'] ?>">(Read More)</a>

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

Re: [gkornbluth] Shor intro on Homepage, Full intro on about us page

By jacgo - November 28, 2011

Thanks for the quick reply.

I don't know how to post short intro on my Homepage from my "about_usDetail.php" page.

is there any one who know how to do?

Many thanks!

-jacgo

Re: [jacgo] Shor intro on Homepage, Full intro on about us page

By Damon - November 28, 2011

Hi Jacgo,

The most simple solution is to create another textbox field in your About Us section editor in CMS Builder just for the homepage content.

You could call it Intro About Us, for example, and add it as a textbox field.

Add your content that you want to have appear on the homepage. Then add the publish code for that field to the homepage template and a link under that back to the About Us page.

How does that sound? Let me know if you have any questions or need more details.

Thanks!
Cheers,
Damon Edis - interactivetools.com

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