Results 1 to 2 of 2

Thread: Story.php

  1. #1
    Pligg Founder Yankidank's Avatar
    Joined
    Dec 2005
    Location
    San Francisco, CA
    Posts
    5,063
    Site
    http://pligg.com/demo/

    Story.php

    Reserved for future use.
    The Facebook Module for Pligg CMS!
    Register, Login, and Submit Stories with Facebook. An absolute MUST HAVE for all Pligg sites!

  2. #2
    Pligg Founder Yankidank's Avatar
    Joined
    Dec 2005
    Location
    San Francisco, CA
    Posts
    5,063
    Site
    http://pligg.com/demo/

    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.
    [h2]story.php[/h2]
    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.

    [h2]story_center.tpl [/h2]

    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.

    [h2]story.php[/h2]
    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

    [h2]/libs/comment.php [/h2]
    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');
    [h2]Overview[/h2]
    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.

Similar Threads

  1. How to make the meta tag of the story page the story title
    By oobie11 in forum Questions & Comments
    Replies: 0
    Last Post: 02-20-2010, 12:32 AM
  2. how to pass variable from releated story to featured story?
    By jackyu in forum Questions & Comments
    Replies: 1
    Last Post: 03-01-2008, 03:20 AM
  3. Replies: 3
    Last Post: 02-12-2008, 04:33 AM
  4. How to direct story title in summary page to the original story?
    By chris79 in forum Questions & Comments
    Replies: 4
    Last Post: 02-03-2008, 04:28 PM
  5. How to open story page when click story title?
    By jetbrains in forum Questions & Comments
    Replies: 1
    Last Post: 08-19-2006, 07:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Pligg Modules and Pligg Templates from Pligg Pro Donate to Pligg CMS Dreamhost Web Hosting Host Gator Web Hosting