Forums / Templates, Stylesheets, Page Layout / How do I display EZ-Pages on main page?

How do I display EZ-Pages on main page?

Views: 988

Results 1 to 6 of 6
10 Oct 2011, 7:15 PM
#1
dmcracing avatar

dmcracing

New Zenner

Join Date:
Sep 2011
Posts:
6
Plugin Contributions:
0

How do I display EZ-Pages on main page?

I'm looking to use the EZ-Pages as a way of building very easy to manage content sections. Example: Open up the homepage, and in the center content area various EZ-Pages would be stacked beneath each other. One EZ-Page would be of Youtube videos, then another would be of race event updates (we are a drag racing company). I would just like to avoid managing all this content under define_main_page.php.

If anyone can tell me if this is possible, as of right now I've only found the way to display certain specific product pages upon opening the home page.

Thanks!

10 Oct 2011, 8:01 PM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: How do I display EZ-Pages on main page?

dmcracing:

I would just like to avoid managing all this content under define_main_page.php.

That's the only way I can think of to do it. There's no built-in facility to display EZ page links on the main page.

10 Oct 2011, 8:08 PM
#3
dmcracing avatar

dmcracing

New Zenner

Join Date:
Sep 2011
Posts:
6
Plugin Contributions:
0

Re: How do I display EZ-Pages on main page?

There has got to be a way to modify the tpl_index_default.php file and add a requirement to display an ezpage. I mean if you have the capability to show product categories and sort their order, it stands to reason a savvy PHP guru who is not myself, could make this dream into a reality. I'll keep plugging away at it and share any breakthroughs should there be one.

Thanks

16 Nov 2012, 12:05 PM
#4
skwebdev avatar

skwebdev

New Zenner

Join Date:
Nov 2012
Posts:
3
Plugin Contributions:
0

Re: How do I display EZ-Pages on main page?

Add something like this to tpl_index_default.php:

<?php $my_content = $db->Execute("select * from " . TABLE_EZPAGES . " where pages_id=3"); ?>
	<h2><?php echo $my_content->fields['pages_title']; ?></h2>
	<?php echo $my_content->fields['pages_html_text']; ?>

You'll need to change 'pages_id=3' to match whatever ezpage ID you want to pull the content from.

If you wanted to have a summary of the content from this page and a link to 'Read More' you'd do something like:

<?php
$my_content_id = 3;
$my_content = $db->Execute("select * from " . TABLE_EZPAGES . " where pages_id=$my_content"); ?>

<h2><?php echo $my_content->fields['pages_title']; ?></h2>
<?php echo zen_trunc_string(zen_clean_html(stripslashes($my_content->fields['pages_html_text'])), 200); ?>
<div><a href="<?php echo zen_ez_pages_link($my_content_id); ?>">Read more > ></a></div>

Here I'm setting a var to store the ezpage ID ($my_content_id). You can change the length of the truncated text by setting a different value where it says '200'.

16 Nov 2012, 2:10 PM
#5
skwebdev avatar

skwebdev

New Zenner

Join Date:
Nov 2012
Posts:
3
Plugin Contributions:
0

Re: How do I display EZ-Pages on main page?

Correction to the above code (there was an error including the id in the sql query and I improved the HTML slightly):

<?php
$my_content_id = 3;
$my_content = $db->Execute("select * from " . TABLE_EZPAGES . " where pages_id=$my_content_id"); ?>

<h2><?php echo $my_content->fields['pages_title']; ?></h2>
<p>
<?php echo zen_trunc_string(zen_clean_html(stripslashes($my_content->fields['pages_html_text'])), 200); ?>
<span style="float:right;"><a href="<?php echo zen_ez_pages_link($my_content_id); ?>">Read more > ></a></span>
</p>
17 Nov 2012, 6:28 PM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How do I display EZ-Pages on main page?

Do you absolutely want to use the ez-pages editor to create the content, as opposed to the define pages editor? If you just don't want everything crammed into one define_main_page.php file, you could use Editable Centerboxes from Plugins. This will let you insert up to nine centerboxes which can be styled any way you like, positioned in several locations on the homepage or other pages, and edited in the define pages editor. It also now lets you pull in standard sideboxes and display them in the center column if you want.