Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

[Solved] [Documentation] Smarty Templates default.master.tpl usage question.

peregrineperegrine MVP
edited June 2012 in Vanilla 2.0 - 2.8

Can anyone shed some light? If you know the answer to anyone one of these - please reply.

items like this

{if $User.CountNotifications} 

is this referencing the $Session object, $Sender object, or getting info directly from User table? Can anybody shed light on this?

{if CheckPermission('Garden.Settings.Manage')}

Can I use all functions like this, if not where are the available functions read from?

{if !$User.SignedIn}

once again - what is the $User referencing exactly?

{event name="BeforeSignInLink"}
how are these references used and integrated into app.
where would call this event and what would be the procedure?

if I wanted to pick up info from a particular table or a unique object how would the call be made in Smarty or would you have to write a function?


is this file actually called somewhere. it is located in library/vendors/SmartyPlugins.

block.permission.php

modifier.date.php

I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Tagged:

Answers

  • peregrineperegrine MVP
    edited June 2012

    Time to file this one in the unanswered questions. My batting average for answered questions - approaching 0.

    either the question
    - doesn't make sense
    - nobody knows
    - nobody cares
    - somebody knows but hasn't provided any info.

    other variables found
    {$BodyID}
    {$BodyClass}
    {$User.Name}
    {$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    Shadowdare
  • peregrineperegrine MVP
    edited June 2012

    how to make a comment in smarty {* the comment *}

    more tags:

    to display photo

    {photo_link}

    to display logo

    {logo}

    others

    {user_link}

    {drafts_link}

    {nomobile_link}

    {category_link}

    if anyone wants to add these to
    http://vanillawiki.homebrewforums.net/index.php/Using_Smarty_with_Vanilla

    feel free.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    Shadowdare
  • peregrineperegrine MVP
    edited June 2012

    solved @underdog.

    question 1 somewhat - it is an associative array of 4 items retrieved through the ether - if you find out where the array is created.

    to print values for $User array.

    {foreach key=key item=item from=$User}


    {$key} - {$item}

    {/foreach}

    results

    Name - Peregrine

    CountNotifications - 0

    CountUnreadConversations - 1

    SignedIn - 1

    so you can use

    {$User.Name}
    {$User.CountNotifications}
    {$User.CountUnreadConversations}
    {$User.SignedIn}

    How to find all Smarty variables known to vanilla-kind.

    go to 
    /library/vendors/Smarty-2.6.25/libs/Smarty.class.php
    
    on line   105
    
    change
    var $debugging       =  false;
    
    to true
    var $debugging       =  true;
    
    
    click on the the vanilla pages and it will open a popup if you haven't blocked popups.  Every variable on each page that you click on will be shown.
    
    
    e.g.
    
    {$Discussions}  Array (10)
    0 => Array (48)
      Type => null
      FirstUserID => "5"
      FirstDate => "2012-06-15 20:54:00"
      CountBookmarks => null
      Body => "Peregrine was here"
      Format => "Markdown"
      LastDate => "2012-06-15 20:54:00"
      LastUserID => null
      DiscussionID => "24"
      ForeignID => null
      CategoryID => "1"
      InsertUserID => "5"
      UpdateUserID => "5"
      LastCommentID => null
      Name => "this is my discussion"
      Tags => ""
      CountComments => "1"
      CountViews => "1"
      Closed => "0"
      Announce => "0"
      Sink => "0"
      DateInserted => "2012-06-15 20:54:00"
      DateUpdated => "2012-06-15 20:54:00"
      InsertIPAddress => "127.0.0.1"
      UpdateIPAddress => "127.0.0.1"
      DateLastComment => "2012-06-15 20:54:00"
      LastCommentUserID => null
      Score => null
      Attributes => null
      RegardingID => null
      WatchUserID => "5"
      DateLastViewed => "2012-06-15 20:54:01"
      Dismissed => "0"
      Bookmarked => "0"
      CountCommentWatch => "1"
      Url => "http://localhost/vanilla/discussion/2..."
      CountUnreadComments => 0
      FirstName => "peregrine"
      FirstEmail => "[email protected]"
      FirstPhoto => "userpics/418/5XO83IOLVSY1.jpg"
      FirstGender => "m"
      LastName => null
      LastEmail => null
      LastPhoto => null
      LastGender => null
      Category => "General"
      PermissionCategoryID => "-1"
      CategoryUrlCode => "general"
    
    --------
    then you can insert codes you found and want to use in your template like so:
    
    {$Discussions[0].FirstPhoto}    
    
    
    here -{$User|@count}
    
    
    {$path}
    
    {foreach key=key item=item from=$Discussion}
    <br>discussion {$key} - {$item}</br>
    {/foreach}
    
    {foreach key=key item=item from=$Discussions[0]}
    <br>{$key} - {$item}</br>
    {/foreach}
    
    category - {$Category.Name}
    {$Breadcrumbs.DateInserted}
    discussion count {$CountDiscussions}
    {foreach key=key item=item from=$User}
    <br>{$key} - {$item}</br>
    

    also see
    http://vanillaforums.org/discussion/comment/162608/#Comment_162608

    http://vanillawiki.homebrewforums.net/index.php/Using_Smarty_with_Vanilla

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    aeryFinne
Sign In or Register to comment.