Creating a Blog
3 posts by 2 authors in: Forums > CMS Builder
Last Post: May 13, 2013 (RSS)
By knight_oWL19 - May 11, 2013
Hi there,
I'm trying to create a blog using CMS Builder. Have done this before however has been awhile since I've worked with this. In the code generator for section I am selecting the following: Combination List and Detail Page, show links to many records and full details on one record.
When the code is generated I am getting the the code to convert the html list page into php, the record (list) snippets I've created (Title, Created On date, Title 2, Content, Summary) in the section editor and the corresponding snippets for the full record detail page. My question is, where is the code that I need to convert the full record detail page to php? Hope that makes sense.
Here are the pages:
http://www.enlightenthesoul.com/blog.html
http://www.enlightenthesoul.com/full_story.html
Also, for the list page, do I only need to paste the list snippets once? I've selected 3 records per page...
also for pagination within the list page I have the following code in my previous blog:
<!-- START PAGINATION CODE -->
<?php if ($newsMetaData['prevPage']): ?>
<a href="<?php echo $newsMetaData['prevPageLink'] ?>"><< prev</a>
<?php else: ?>
<< prev
<?php endif ?>
<?php
if (@!$_GET['page']): $current_page = "1";
else: $current_page = $_GET['page'];
endif; ?>
<?php foreach (range(1,$newsMetaData['totalPages']) as $page): ?>
<?php if ($page == $current_page): ?>
<strong><?php echo $page; ?></strong>
<?php else: ?>
<a href="?<?php echo http_build_query(array_merge($_REQUEST, array( 'page' => $page ))) ?>"><?php echo $page; ?></a>
<?php endif ?>
<?php endforeach; ?>
<?php if ($newsMetaData['nextPage']): ?>
<a href="<?php echo $newsMetaData['nextPageLink'] ?>">next >></a>
<?php else: ?>
next >>
<?php endif ?>
<!-- /END PAGINATION CODE -->
Will this suffice for pagination code if I swap $newsMetaData WITH $ets_blogMetaData?
Thanks!
ep
By gkornbluth - May 12, 2013 - edited: May 12, 2013
Hi knight_oWL,
Unless I'm not understanding, once your php code is on your page you need only to change the extension from html to php.
The code for converting the full record detail page to php is in step 2 near the bottom of the generated code
And yes, you only have to paste the code once.
I'm assuming that you've entered some test records into your section, so that your test page will be populated with some text pulled from your records. ( http://www.lipsum.com/ is a great source of placeholder text )
If you're unsure of how to set up your pages, start by copying the entire page from the code generator to a new document and save it as something like blogtest..php (the important part is the ,php)
There's also a detailed getting started guide in my CMSB Cookbook http://www.thecmsbcookbook.com that should clear up a lot of the 'mystery' surrounding the converting of html pages to php.
Hope that helps to set you in the right direction,
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
By knight_oWL19 - May 13, 2013 - edited: May 13, 2013
Thanks Jerry,
I will look more closely at this and give it a go. I understand how to convert the pages, I just didn't see the header code for the full record page. maybe I missed it.
also, any thoughts on the pagination code?
ep