The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Help : customise block in the sidebare
I have a php file inspire the product "Rate My Photo (HorOrNot Clone)" and correctly displays the best picture of my database and uses a template but I am unable to make my block:
the php code PHP Code:
HTML Code:
<li> <div class="block smaller"> <div class="blocksubhead"> Meilleur photo </div> <div id="block_title" class="blockbody floatcontainer" {vb:raw content.style}> <div class="blockrow"> <img src="../forum/ratemyphoto/photo/thumbs/{vb:raw bestphotoname}"/> </div> </div> </div> <div class="underblock"></div> </li> </div> </div> </div> <div class="underblock"></div> |
#2
|
|||
|
|||
Try this for the code:
Code:
global $vbulletin; $bestphoto =$vbulletin->db->query_first("SELECT * FROM vb_ratemyphoto_photos WHERE approved=1 AND hidden=0 AND rating>0 ORDER BY rating DESC, votes DESC LIMIT 1"); $besttitle = htmlspecialchars_uni($bestphoto["title"]); $bestphotoname = $bestphoto["logo"]; $bestvotes = $bestphoto["votes"]; $bestrating = $bestphoto["rating"]; $templater = vB_Template::create('block-photo'); $templater->register('besttitle', $besttitle); $templater->register('bestphotoname', $bestphotoname); $templater->register('bestvotes', $bestvotes); $templater->register('bestrating', $bestrating); $templater->register('bestuserid', $bestphoto[userid]); $templater->register('bestusername', $bestphoto[username]); $templater->register('catid', $catid); return $templater->render(); |
#3
|
||||
|
||||
Thank you but the block still appears empty
|
#4
|
|||
|
|||
Have you created the template called "block-photo" (or does it exist already)?
|
#6
|
|||
|
|||
Well, I can't really tell what's going on from that. One thing is that the template you posted doesn't have the tags matched - there's one more </div> than there is <div>.
Are you entering that template name in "Template to use"? If so, set "Template to Use" to block_html. Also, set "Cache Time (in minutes)" to 0 until you get it working, then set it to the number of minutes you want to cache. |
#7
|
||||
|
||||
Replace this line:
PHP Code:
PHP Code:
|
#8
|
||||
|
||||
the new template :
HTML Code:
<div class="block smaller"> <div class="blocksubhead"> Meilleur photo </div> <div class="widget_content blockbody floatcontainer"> <div class="blockrow" align="center"> <A HREF="ratemyphoto/photos/{vb:raw bestphotoname}"><img border="0" src="ratemyphoto/photos/thumbs/{vb:raw bestphotoname}"></A><br /> </div> </div> </div> <div class="underblock"></div> --------------- Added [DATE]1357149292[/DATE] at [TIME]1357149292[/TIME] --------------- Quote:
PHP Code:
|
#9
|
|||
|
|||
It says "block_photo" (unless you meant you changed it after making the screen grab). It *is* possible to use a custom template name there, but unless you want the "frame" part to look different than other blocks, I wouldn't do it that way.
|
#10
|
||||
|
||||
All your variables need to be returned as an array. Example:
PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|