Go Back   Pligg Forum > Pligg Help > Wiki Articles
 
 
LinkBack Article Tools Display Modes
  #1 (permalink)  
Old 09-03-2007, 04:28 PM
Yankidank's Avatar
Yankidank Yankidank is offline
Send a message via AIM to Yankidank Send a message via Skype™ to Yankidank
Pligg Founder
Pligg Version: 9.9
Pligg Template: Blue Green Str
 
Join Date: Dec 2005
Location: Savannah, GA
Posts: 1,359
Downloads: 58
Uploads: 6
Thanks: 88
Thanked 139 Times in 93 Posts
Story.php

Reserved for future use.
__________________
Need a Pligg Host?
Get 3 free months
when you buy a year of hosting.
Use the coupon PLIGG at either...
MidPhase hosting starting at $7.95/month.
ANhosting hosting starting as low as $4.95/month.

Last edited by Yankidank : 09-03-2007 at 05:11 PM.
Reply With Quote
Sponsored Links
Check out the New Modules at the Pligg Pro Shop.
  #2  

Story.php

How comments work (story.php)

This is a small guide for anyone trying to learn about the current template, understand it, implement it and possibly give solutions to making it more efficient. It’s more of a walk through if you were looking at the code. Please download the latest code and unravel the secrets of Pligg.
 

Contents

story.php


It gets the ID or title and reads the data from the database.

Code:
 $link->read();
It uses assign to pass down values to the template For story.php, It is going to use story_center as the main center body

Code:
 $main_smarty->assign('tpl_center', $the_template . '/story_center'); 
 $main_smarty->display($the_template . '/pligg.tpl');
If you look at pligg.tpl, it is the basic layout of the whole page. It has {include file="$tpl_center.tpl"} which will include the body of the page.
In the case of story.php it will be story_center.tpl.

story_center.tpl



Code:
 $link->print_summary();
What this does it print the main text of the story (This will be covered in another text)
Further down the page you will see

Code:
 get_comments();
This is what prints all the comments in story.php
get_comments is declared in story.php, so back we go.

story.php


get_comments will retrieve all the comments which are the parent. It prints the parent first using $comment->print_summary($link); And then it finds all the comments that replied to the parent comment, and prints them using $comment->print_summary($link);
So we have

Parent Comment
-Child comment
-Child comment
-Child comment

Parent Comment
-Child comment
-Child comment

$comment->print_summary is declared in /libs/comment.php

/libs/comment.php


It reads the comment from the database using the $link that is passed from story.php

Code:
 if(!$this->read) return;
It assigns the values from the database to variables so they can be accessed by the template

Code:
 $smarty->assign('comment_id', $this->id);
 $smarty->assign('comment_author', $this->author);
 $smarty->assign('comment_link', $this->link);
Then it displays the comment using

Code:
 $smarty->display($the_template . '/comment_show.tpl');

Overview


Pligg.tpl is the main layout.
Story_center.tpl is the story layout which prints the story, get_comments, and shows the comment form
Comment_show.tpl is the layout of an individual comment.


Contributors: clubkb
Created by Yankidank, 09-03-2007 at 04:28 PM
Last edited by Yankidank, 09-12-2007 at 04:57 PM
1 Comments , 870 Views
 



Article Tools
Display Modes
Posting Rules
You may not create new articles
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
read more link @ story.php or link_summery.tpl? DailyResearch General Help 2 05-09-2007 12:12 PM
Story.php -> error 2 -> blank page?? diablo Bug Report 0 04-18-2007 06:01 PM
story.php forum like feature noyp Drawing Board 2 12-06-2006 01:58 PM
Buf Fix to story.php Aviran Bug Report 0 10-09-2006 09:16 PM
story.php have problem.. topcc General Help 2 03-21-2006 10:23 AM


LinkBacks Enabled by vBSEO 3.0.0