The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Help with side blocks pease
Hello everyone - I wonder if someone could give some pointers please. I recently bought a forum that was already established, so I am pretty naive about the nuts and bolts behind the scene
The version is 4.2.3 There is currently a section that renders a selection of 4 random photos drawn from a gallery elsewhere. I would like to move it to a side block so I can use that space for something else. I stupidly thought I could copy and paste the template code into a side block and that would be that, having removed the title bar, but all that happens is that the side block renders some of the code, irrespective of whether I paste it as html or php The template code that currently does the job is below. <vb:if condition="!empty($pppro_imagebits)"> <div id="pppro"></div> <ol class="floatcontainer"> <li class="forumbit_nopost"> <div class="forumhead foruminfo L1 collapse"> <a class="collapse" id="collapse_featurepal" href="forum.php#top"><img src="images/buttons/collapse_40b.png" alt="" /></a> <h2><span class="forumtitle"> From the Gallery</span></h2> </div> <ol class="childforum"> <li class="forumbit_post"> <div id="featurepal" class="forumrow table"> <table class="tborder" cellpadding="0" cellspacing="0" border="0" width="100%" align="center"> <tr> <td> <br /> <table cellpadding="$stylevar[cellpadding]" cellspacing="1" border="0" width="100%"> <tr> {vb:raw pppro_imagebits} </tr> </table> <br /> </td> </tr> </table> </div> </li> </ol> </li> </ol> <br /> </vb:if> Anyone kind enough to reply should assume I am an idiot with no knowledge. I am more than happy to be talked down to Best wishes |
#2
|
||||
|
||||
What hook are you using to add the needed php code and what is the code you are adding there?
|
#3
|
|||
|
|||
Thanks for your reply Lynne
I know nothing about hooks I'm afraid I simply pasted the code above into the block, then tried experimenting with it when I found it didn't work. |
#4
|
||||
|
||||
Typically in a forum block, you need to return data, just as if you are operating inside a PHP function with local variables. You would need to build your data, then render your HTML containing the data you built, and return the finished HTML.
For example, here is the PHP code I use for a simple forum block that displays the users who have visited the site within the last 7 days: PHP Code:
|
#5
|
|||
|
|||
Simple is a relative term Mark
However, I have found that using a table with a sidebar block does not output with the desired effect. My knowledge of writing PHP is limited as well. I would take some time and research past threads, someone might have already built out something that you are looking for (you might need to modify a bit) |
#6
|
||||
|
||||
I have a forum side block that will pull a single image from any gallery you want ....
Replace the id which is highlighted in red with the id of the album which you want to use ... You can also change the width of the sideblock as well, the width for this one is highlighted in red and its 225 px ... Code:
// -- Widget Configuration -- $use_vB_thumbnail_size = false; $use_custom_css = true; $twidth = 225; $limit = 1; $albums_list = "17"; // -- Nothing to configure below this line -- if ($use_custom_css){ $pthumb = 'class="pthumb"'; $pcaption = 'class="pcaption"'; $pmore = 'class="pmore"'; $pstyle = ''; }else{ $pthumb = 'style="text-align:center;"'; $pcaption = 'style="text-align:center;font-style:italic;font-family: Times, serif;margin-bottom:10px;"'; $pmore = 'style="text-align:right;display:block;"'; $pstyle = 'style="border: 1px solid black;padding:4px;background: white;"'; } if ($albums_list!="") $sup_cond = "AND alb.albumid IN ($albums_list)"; else $sup_cond =""; ob_start(); require_once(DIR . '/includes/functions_album.php'); require_once(DIR . '/includes/functions_user.php'); $pic_get = vB::$db->query_read(" SELECT alb.albumid, att.attachmentid, att.userid, att.caption, att.dateline, att.state, fdt.filesize, IF(fdt.thumbnail_filesize > 0, 1, 0) AS hasthumbnail, fdt.thumbnail_dateline, fdt.thumbnail_width, fdt.thumbnail_height, u.username FROM ".TABLE_PREFIX."album AS alb LEFT JOIN ".TABLE_PREFIX."attachment AS att ON alb.albumid = att.contentid LEFT JOIN ".TABLE_PREFIX."filedata AS fdt ON att.filedataid = fdt.filedataid LEFT JOIN ".TABLE_PREFIX."user AS u ON att.userid = u.userid WHERE alb.state = 'public' AND att.contenttypeid = '8' $sup_cond ORDER BY rand(" . microtime()*1000000 . ") LIMIT $limit"); $output_bits = ""; while($pic = vB::$db->fetch_array($pic_get)) { $albuminfo = fetch_albuminfo($pic[albumid]); $picture = prepare_pictureinfo_thumb($pic, $albuminfo); if ($use_vB_thumbnail_size) $size = $picture[dimensions]; else $size = "width=$twidth"; $output_bits .= "<div $pthumb><a href=\"album.php?{$vbulletin->session->vars['sessionurl']}albumid={$pic[albumid]}&attachmentid={$picture[attachmentid]}\"><img $pstyle src=\"attachment.php?{$vbulletin->session->vars['sessionurl']}attachmentid={$picture[attachmentid]}&thumb=0&d={$picture[thumbnail_dateline]}\" alt=\"{$picture[caption_preview]}\" $size /></a>"; $output_bits .= "</div><div $pcaption>{$picture[caption_preview]} by {$pic[username]}</div>"; } $output_bits .= '<span '.$pmore.'><a href="album.php" alt="To the albums">More...</a></span>'; $output = $output_bits; ob_end_clean(); return $output; |
#7
|
|||
|
|||
Thanks for your replies guys.
The current setup renders four random thumbs drawn from multiple albums in Photopost Pro, so although I see where you're coming from CAG, it doesn't really work because there are many album lists not just one. The code below works perfectly in the main body of the home page, and all I'm trying to do is make it work in a sideblock instead. Mark, the data is built and works just fine where it is, I just have no understanding of hooks and returns and so on to make it work in a block. I know I am probably being particularly dim, but when you don't know, you just don't know. Code:
<vb:if condition="!empty($pppro_imagebits)"> <div id="pppro"></div> <ol class="floatcontainer"> <li class="forumbit_nopost"> // -- i know I can get rid of this <div> for the haeder, it won't be needed, and the ol and li classes too -- <div class="forumhead foruminfo L1 collapse"> <a class="collapse" id="collapse_featurepal" href="forum.php#top"><img src="images/buttons/collapse_40b.png" alt="" /></a> <h2> <span class="forumtitle">{vb:rawphrase pp_featured_photos}</span></h2> </div> <ol class="childforum"> <li class="forumbit_post"> <div id="featurepal" class="forumrow table"> <table class="tborder" cellpadding="0" cellspacing="0" border="0" width="100%" align="center"> <tr> <td> <br /> <table cellpadding="$stylevar[cellpadding]" cellspacing="1" border="0" width="100%"> <tr> {vb:raw pppro_imagebits} </tr> </table> <br /> </td> </tr> </table> </div> </li> </ol> </li> </ol> <br /> </vb:if> |
#8
|
||||
|
||||
Ok try this ...
Make a new template and call it some like "block_html_random_photos" Inside the template add this Code:
<vb:if condition="is_member_of($bbuserinfo, 9)"> <li> <div class="block smaller" id="pppro"> <div class="blocksubhead"> <a class="collapse" id="collapse_block_html_{vb:raw blockinfo.blockid}" href="{vb:raw relpath}#top"><img alt="" src="{vb:stylevar imgdir_button}/collapse_40b.png" width="16" height="16" id="collapseimg_html_{vb:raw blockinfo.blockid}"/></a> <span class="blocktitle">{vb:rawphrase pp_featured_photos}</span> </div> <div class="widget_content blockbody floatcontainer"> <div id="block_html_{vb:raw blockinfo.blockid}" class="blockrow"> {vb:raw pppro_imagebits} </div> </div> </div> <div class="underblock"></div> </li> </vb:if> Make it an html block then inside the content block add this Code:
<div align="center"><!--{vb:raw pppro_imagebits}--></div> Code:
<div align="center">{vb:raw pppro_imagebits}</div> One of these should work .... Let me know if it works for yah' |
#9
|
|||
|
|||
Thanks for your reply. Unfortuantely neither works. They both render nothing at all, but I'm really grateful to you for trying.
|
#10
|
||||
|
||||
Are you putting this side block on the same page that the current random images are on? If you go to admincp > Products & Hooks > Manage Products, do you see anything titled that may be the modification being used here? If so, then go to admincp > Products & Hooks > Hook Manager and look up the plugins for that Product - can you give us the titles and then hook location for them? And, are you creating a Forum Block or are you trying to create a CMS Block?
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|