Difference between revisions of "Variables you can use in theme files"
From JReviews Documentation
Line 76: | Line 76: | ||
| <source lang="php"><?php echo $listing['Review']['user_rating_count'];?></source> || Number of user ratings | | <source lang="php"><?php echo $listing['Review']['user_rating_count'];?></source> || Number of user ratings | ||
|- | |- | ||
− | | <source lang="php"><?php echo $listing['Review'][' | + | | <source lang="php"><?php echo $listing['Review']['user_review_count'];?></source> || Number of user reviews |
|- | |- | ||
| <source lang="php"><?php echo $listing['Review']['editor_rating'];?></source> || Editor rating | | <source lang="php"><?php echo $listing['Review']['editor_rating'];?></source> || Editor rating | ||
Line 96: | Line 96: | ||
You can use any of the above variables to create conditionals, for example: | You can use any of the above variables to create conditionals, for example: | ||
<source lang="php"> | <source lang="php"> | ||
− | <?php if($listing['Review'][' | + | <?php if($listing['Review']['user_review_count']): // if user review exists ?> |
// display something | // display something | ||
<?php else: ?> | <?php else: ?> |
Revision as of 21:17, 23 August 2018
$listing array
The $listing array contains all the data of a certain listing
It is used in these files:
- /listings/detail.thtml
- /listings/detail_tabs.thtml
- /listings/detail_compact.thtml
- /listings/listings_blogview.thtml
- /listings/listings_blogview_compact.thtml
- /listings/listings_tableview.thtml
- /listings/listings_thumbview.thtml
- /listings/listings_masonry.thtml
- /modules/listings.thtml
In those files you can add any data from the $listing array. Here is a list of mostly used ones:
<?php echo $listing['Listing']['listing_id'];?> |
Listing ID |
<?php echo $listing['Listing']['title'];?> |
Listing Title |
<?php echo $listing['Listing']['slug'];?> |
Listing Alias |
<?php echo $listing['Listing']['summary'];?> |
Listing summary text |
<?php echo $listing['Listing']['description'];?> |
Listing description text |
<?php echo $listing['Listing']['text'];?> |
Summary + Description |
<?php echo $listing['Listing']['media_count'];?> |
Media count |
<?php echo $listing['Listing']['photo_count'];?> |
Photo count |
<?php echo $listing['Listing']['video_count'];?> |
Video count |
<?php echo $listing['Listing']['audio_count'];?> |
Audio count |
<?php echo $listing['Listing']['attachment_count'];?> |
Attachment count |
<?php echo $listing['Listing']['hits'];?> |
Number of visits |
<?php echo $Time->nice($listing['Listing']['created']);?> |
Created date |
<?php echo $Time->nice($listing['Listing']['modified']);?> |
Modified date |
<?php echo $listing['Category']['cat_id'];?> |
Category ID |
<?php echo $listing['Category']['title'];?> |
Category Title |
<?php echo $listing['Category']['slug'];?> |
Category Alias |
<?php echo $listing['Directory']['dir_id'];?> |
Directory ID |
<?php echo $listing['Directory']['title'];?> |
Directory Title |
<?php echo $listing['ListingType']['listing_type_id'];?> |
Listing Type ID |
<?php echo $listing['ListingType']['title'];?> |
Listing Type Title |
<?php echo $listing['User']['user_id'];?> |
Listing author's ID |
<?php echo $listing['User']['name'];?> |
Listing author's real name |
<?php echo $listing['User']['username'];?> |
Listing author's username |
<?php echo $listing['User']['email'];?> |
Listing author's email |
<?php echo $listing['Review']['user_rating'];?> |
User rating |
<?php echo $listing['Review']['user_rating_count'];?> |
Number of user ratings |
<?php echo $listing['Review']['user_review_count'];?> |
Number of user reviews |
<?php echo $listing['Review']['editor_rating'];?> |
Editor rating |
<?php echo $listing['Review']['editor_rating_count'];?> |
Number of editor ratings |
<?php echo $listing['Review']['editor_review_count'];?> |
Number of editor reviews |
<?php echo $listing['MainMedia']['media_info']['image']['url'];?> |
Main Media URL |
<?php echo $listing['Favorite']['favored'];?> |
Number of users who added listing to their favorite list |
<?php echo $listing['Claim']['approved'];?> |
The listing's current claim status |
Conditionals
You can use any of the above variables to create conditionals, for example:
<?php if($listing['Review']['user_review_count']): // if user review exists ?> // display something <?php else: ?> // display something else <?php endif;?>