More Customisable?

This is a discussion on "More Customisable?" within the PHP Forum section. This forum, and the thread "More Customisable? are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Feb 3rd, 2008, 18:11
Jack Franklin's Avatar
Resources Administrator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,268
Blog Entries: 7
Thanks: 10
Thanked 4 Times in 4 Posts
More Customisable?

ME again, but this is more of a query then something I'm stuck with.

When developing a WordPress theme, each part of the post is a different function, EG:
Code: Select all
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
   <h4 class="date"><?php the_time('M jS') ?></h4>
My function currently just gets it all:
PHP: Select all

function display_posts() {
global 
$postnumber;
$display_posts_home mysql_query("SELECT contentid, contenttitle, contentintro, content, author, category, homepage, date_format(date, '%M %D, %Y') AS date FROM content WHERE homepage='Y' ORDER BY contentid DESC LIMIT 0 ,$postnumber");
if(!
$display_posts_home) {
echo 
'<h4>Error Displaying Content.' mysql_error() . '</h4>';
}
while (
$posts mysql_fetch_array($display_posts_home)) {
$contentid $posts['contentid'];
$contenttitle $posts['contenttitle'];
$contentintro $posts['contentintro'];
$content $posts['content'];
$author $posts['author'];
$category $posts['category'];
$date $posts['date'];
$comments_number =  mysql_query("SELECT count(commentsid) FROM comments WHERE commentsid = '$contentid'") or die(mysql_error());
 
$results mysql_result($comments_number"0"); 
//display
echo '<div class="post">';
echo 
'<h4 class="homepageposttitle"><a href="single.php?contentid=' $contentid '">' $contenttitle '</a></h4>';
echo 
'<h5 class="homepagepostinfo"><span class="postid">#' $contentid ' |</span>  By <span class="postauthor">' $author ' </span> On: <span class="postdate">' $date '</span></h5>';
echo 
'<p class="homepagepostintro">' $contentintro '</p>';
if (
$results==1) {
echo 
'<p class="homepagepostcomments">There has been ' $results ' Comment</p>';
} else {
echo 
'<p class="homepagepostcomments">There have been ' $results ' Comments</p>';
}
echo 
'<a href="single.php?contentid=' $contentid '">Continue Reading "' $contenttitle '"</a></div>';
}

And that is fine for me, but for people who want to customize the way their posts are displayed, they cannot. How can I emulate the way WordPress looks, and have a function for finding each seperate part of each post?
Last Blog Entry: My Latest Project - Grilling Gurus... (Jun 11th, 2008)
Reply With Quote

Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 05:50.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43