Long Articles

7 posts by 3 authors in: Forums > CMS Builder
Last Post: February 14, 2012   (RSS)

Re: [Toledoh] Long Articles

By Jason - February 8, 2012

Hi Tim,

One way to approach this would be to have each page be a separate record. This would make pagination easy to deal with. The PDF print version could be a page that just ouputs each record of the report.

Of course, the simpliest solution would be to have the report created as a PDF using another program, and then uploaded to CMS Builder to publish it on the web.

Hope this helps
---------------------------------------------------
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] Long Articles

By Toledoh - February 8, 2012

Thanks Jason,

I was thinking, wouldn't there be some way of putting in a something like "***page-break*** that could then be replaced by an if statement that converted it to either tabs, or some kind of pagination?

Just thinking...
Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] Long Articles

By gkornbluth - February 9, 2012 - edited: February 9, 2012

Hi Tim,

There are 2 CSS properties, page-break-after and page-break-before that you can apply to your elements to try and keep things organized.

Here's a link to the spec.
http://www.w3.org/TR/css3-page/#pg-br-before-after

There's also some information on handling page breaks in the readme file in your /cmsAdmin/plugins/createPDF/wkhtmltopdf folder

Problem is that there's still limited browser support for these properties and a lot of caveats. (Have a look at the page break section at http://www.w3schools.com/cssref/

I've never tried, but once you get the simple case working you might be able to combine those properties with if statements comparing word counts or line counts with paragraphs to determine the length of pages. (also just thinking...)

I've also found that image are a bit tricky and sometimes can span pages.

Hope that gets you started.

I'd be interested in hearing about your successes and the challenges you encounter along the way.

Jerry Kornbluth
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] Long Articles

By Toledoh - February 9, 2012

Thanks Jerry,

I think I'm going to try to work through a system using jquery tabs... I'll let you know how I progress.
Cheers,

Tim (toledoh.com.au)

Re: [Jason] Long Articles

By Toledoh - February 9, 2012 - edited: February 9, 2012

Can someone help me with "placeholders" for this?

I want to enter something like **break-tab1** in the WYSIWYG, and then use something like

<?php echo str_replace('**break',......

to get
<span class="tab1">tab1</span>

Any ideas?
Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] Long Articles

By Jason - February 14, 2012

Hi Tim,

If you know how many tabs you need you could try something like this:

Example:

<?php

$content = $record['content'];

foreach (range(1, 5) as $tab) {
$placeHolder = "**break-tab$tab**";
$tabHTML = "<span class = \"tab$tab\">tab$tab</span>";

$content = str_replace($placeHolder, $tabHTML, $content);
}

?>

<?php echo $content; ?>


This would work for tabs 1 - 5

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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