Results 1 to 10 of 10

Thread: smarty tag <%$keywords|

  1. #1
    Join Date
    Oct 2007
    Location
    UK Essex
    Posts
    591

    Post smarty tag <%$keywords|

    Hi

    I have been looking for a thread or some documentation either on the Nicecoder community and the smarty website, but im struggling to pinpoint.

    Basically im modifying the rows.html to display the keywords tag but I don’t want all keywords displayed for the listing. I would like to truncate the keywords tag to display the first 4 keywords.

    Is there a switch to add to the end of the <%$keywords| to display this?

    Thanks

  2. #2
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    i think you can only truncate to a certain number of characters, not words, if you want to do that its:

    <%$keywords|truncate:150%> to trim to 150chars.
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

  3. #3
    Join Date
    Oct 2007
    Location
    UK Essex
    Posts
    591

    Default

    Thanks inspireme this works, but i had to apply this to the details_link.html page just to test as the <%$keywords$> tag on rows.html only returns the phrase "ARRAY".

    Does this mean i have to ad the varible somewhere to get it working on this page?

  4. #4
    Join Date
    Oct 2007
    Location
    UK Essex
    Posts
    591

    Default

    bump on this thread anyone

    Pleaase

  5. #5
    Join Date
    Oct 2007
    Location
    UK Essex
    Posts
    591

    Default

    %$keywords$> tag on rows.html only returns the phrase "ARRAY".

    Does this mean i have to ad the varible somewhere to get it working on this page?

  6. #6
    Join Date
    May 2007
    Location
    NJ, United States
    Posts
    1,651

    Default

    I'm far from being a programmer, but I'm pretty sure its suppose to be <%$keywords%> not <%$keywords$>
    FSGDAG | IndexU Hosting | Owner
    Website | NiceCoder Script Hosting and More! | Web4URL is For Sale!
    Follow Us On Twitter | FaceBook Profile | YouTube Videos

  7. #7
    Join Date
    Oct 2007
    Location
    UK Essex
    Posts
    591

    Default

    sorry, typo on the thread....

    its correct code on rows.html, wonder why its displaying "array" when <%$keywords%> is dropped there?

  8. #8
    Join Date
    May 2007
    Location
    NJ, United States
    Posts
    1,651

    Default

    Ok...

    I'm going to take a stab at this.... <%$keywords%> works on the detail_links.html page but doesn't work on rows.html.

    If I'm correct, detail_links.html uses detail.php in the root, and rows.html uses browse.php in the root.

    If we look at detail.php in the root we see :

    PHP Code:
      function ShowDetailPage() {

        
    // vars global configuration
        
    global $dbConn$theme_name$theme_path$rev_max_rows$category_separator;

        
    // vars url & form
        
    global $id;

        
    // vars messages
        
    global $msg;

        
    // vars template
        
    global $link_detail$pagination$review_rows$ofc_review$page_title,
                 
    $link_id$link_title$link_description$link_keywords,
                 
    $category_id$category_name$category_path$category_path_with_link,
                 
    $num_review$avg_review$avg_review_image;


        
    $tpl = new Template();

        
    $links_obj = new clsLink;
        
    $links_obj->query                 "select * from idx_link where link_id = '$id'";
        
    $links_obj->table_name            "idx_link";
        
    $links_obj->category_table_name   "idx_category";
        
    $links_obj->review_table_name     "idx_review";
        
    $links_obj->category_separator    $category_separator;
        
    $links_obj->max_rows              1;
        
    $links_obj->rating_image_path     "themes/" $theme_name "/images/rating/";
        
    $links_obj->rev_rating_image_path "themes/" $theme_name "/images/review/";
        
    $links_obj->date_format           $msg["10161"];
        
    $links_obj->template_file         $theme_path "detail_link.html";
        
    $link_detail                      $links_obj->Display();

        
    // link data
        
    $query "select * from idx_link where link_id = '$id'";
        
    $row   $dbConn->FetchOne($query);
        
    $link_id          $id;
        
    $link_title       $row["title"];
        
    $link_description strip_tags($row["description"]);
        
    $link_keywords    strip_tags($row["keywords"]);
        
    $page_title       $link_title
    and if we look at browse.php we see this :

    PHP Code:
      function ShowCategoryPage() {

        
    // vars global configuration
        
    global $dbConn$theme_path$number_of_links_format,
                 
    $cat_default_image$cat_columns$max_sub_cat$cat_link_style,
                 
    $cat_path_link_style$subcat_link_style$cat_table_width,
                 
    $cat_cellspacing$max_rows$category_separator$theme_name,
                 
    $cat_description_format$site_url;

        
    // vars url & form
        
    global $cat$pg_which;

        
    // vars messages
        
    global $msg;

        
    // vars template
        
    global $header$footer$category$category_name$category_description,
                 
    $link$pagination$category_path$content$editor,
                 
    $category_path_search_opt$meta_keywords$meta_description,
                 
    $page_title$editors$sponsored_link$num_rows,
                 
    $num_rows_sponsored$num_rows_premium;

        
    $tpl = new Template();

        
    $category_obj = new clsCategory;
        
    $category_obj->table_name      "idx_category";
        
    $category_obj->link_table_name "idx_link";

        
    $page_title                    $category_obj->GetPageTitle($cat);
        if (empty(
    $page_title)) {
          
    $page_title $msg["10011"] . $category_separator $category_obj->GetCategoryPath($cat);
        }

        
    $header                        $category_obj->GetHeader($cat);
        
    $footer                        $category_obj->GetFooter($cat);
        
    $meta_keywords                 $category_obj->GetMetaKeyword($cat);
        
    $meta_description              $category_obj->GetMetaDescription($cat);
        
    $content                       $category_obj->GetContent($cat);

        
    $category_obj->separator       $category_separator;
        
    $category_obj->header          $msg["10012"];
        
    $category_name                 $category_obj->GetCategoryName($cat);
        
    $category_description          $category_obj->GetCategoryDescription($cat);
        
    $category_path                 $category_obj->GetCategoryPath($catTRUE);
        
    $category_path                 "<a href=\"$site_url/\" style=\"$cat_path_link_style\">"
                                           
    $msg["10011"] . "</a>"
                                           
    $category_obj->separator
                                           
    $category_path;
        
    $category_path_search_opt      $category_obj->GetCategoryPath($cat); 
    So whats the difference between the two???

    In detail.php, the keywords are being called here:

    PHP Code:
        // vars template
        
    global $link_detail$pagination$review_rows$ofc_review$page_title,
                 
    $link_id$link_title$link_description$link_keywords,
                 
    $category_id$category_name$category_path$category_path_with_link,
                 
    $num_review$avg_review$avg_review_image
    and here:

    PHP Code:
       // link data
        
    $query "select * from idx_link where link_id = '$id'";
        
    $row   $dbConn->FetchOne($query);
        
    $link_id          $id;
        
    $link_title       $row["title"];
        
    $link_description strip_tags($row["description"]);
        
    $link_keywords    strip_tags($row["keywords"]);
        
    $page_title       $link_title
    So I'm guessing that in browse.php you need to add $link_keywords to your //var templates and add $link_keywords = strip_tags($row["keywords"]); around line 60.

    Now after I typed all of this out, I just noticed that there is a $meta_keywords being called in browse.php. What that means, I have NO IDEA!!! LOL

    I'm putting my disclaimer in here:

    DISCLAIMER : Following my advice has been known to cause sparatic tornadoes, higher CO2 emissions, and in some small cases, nuclear winter! Think about this before doing anything I say!!!!!

    My advice... Allow someone 1,000,000 times smarter than me on this board to tell you if I'm right or completely wrong!!!
    FSGDAG | IndexU Hosting | Owner
    Website | NiceCoder Script Hosting and More! | Web4URL is For Sale!
    Follow Us On Twitter | FaceBook Profile | YouTube Videos

  9. #9
    Join Date
    Oct 2007
    Location
    UK Essex
    Posts
    591

    Post

    Thanks for the help FSGDAG, I thought it had to be browse.php, unfortunately to no avail nice try

    I would like to see some documentation on how indexu html files relate back to the appropriate php, and to see a guide for template variables.

    I have some more questions to ask, but dont want to start another thread till I have this sorted.

    BTW roflma disclaimer I have backups so do your worst, thanks for your help

  10. #10
    Join Date
    May 2007
    Location
    NJ, United States
    Posts
    1,651

    Default

    Quote Originally Posted by echo@ View Post
    Thanks for the help FSGDAG, I thought it had to be browse.php, unfortunately to no avail nice try
    Sorry it didn't work I'm sure there is an answer out there though

    Quote Originally Posted by echo@ View Post
    BTW roflma disclaimer
    Yeah, Al Gore threatened to sue me if I didn't start posting those disclaimers! He gets his panties all up in a ruffle over stuff like that
    FSGDAG | IndexU Hosting | Owner
    Website | NiceCoder Script Hosting and More! | Web4URL is For Sale!
    Follow Us On Twitter | FaceBook Profile | YouTube Videos

Similar Threads

  1. Smarty AND/OR
    By beto in forum v5.x
    Replies: 2
    Last Post: 12-18-2006, 04:29 AM
  2. Smarty - Detail.html - Keywords
    By ezykiwi in forum v5.x
    Replies: 2
    Last Post: 09-30-2006, 07:17 AM
  3. Smarty Errors
    By kevinrstruck in forum v5.x
    Replies: 2
    Last Post: 04-02-2006, 05:55 PM
  4. smarty code
    By vittle in forum v5.x
    Replies: 1
    Last Post: 02-21-2006, 05:11 PM
  5. More smarty plugins
    By dody in forum v5.x
    Replies: 1
    Last Post: 12-16-2005, 09:33 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
  •