MyBB Hacks

Full Version: PHP in Templates / Complex Templates
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Nice, thanks zinga!
Thanks for updating this for MyNetwork users ZiNgA BuRgA, its really cool.
Hallo, and back again. I was not sure where to post this as its a question about a plugin file I got from another thread on this board. This is the thread and the plugin:

http://mybbhacks.zingaburga.com/showthre...http://mybbhacks.zingaburga.com/showthread.php?tid=415&pid=29

The plugin adds Xthreads images to profile - its super cool.

Here is a link to the plugin in action so its clearer what I am talking about:

http://www.leefish.nl/mybb/member.php?ac...http://www.leefish.nl/mybb/member.php?action=pro

I was trying to add a small icon above the image in the profile display. Ideally the icon of the game it is for based on the relevant xthreads field I chose for it. Smile

Anyway, that was a bit hard so I decided to try and make it have the word Download above the picture in those forums where I have downloads (forums 7 and 29) and Find in those areas I have finds. The reason I need to make it optional rather than just using the plug in is because I have other users who have contributed to the forum but don't make downloadable sims stuff.

I tried using php in templates in the mnxtigprofile_images_image to do this:

Code:
<if in_array($mnxtigps_forum->forum['fid'], array(7,29)) then>DOWNLOAD <elseif> in_array($mnxtigps_forum->forum['fid'], array(30)) then>FIND</if>



Here is the if function in my template:

Code:
<div style="float: left; height: 250px; padding: 1px; max-height: 250px;">
<table class="trow2" align="center" style="border: 1px solid;" width="185" height="248">
<tbody>
<tr>
<td align="center">
<table align="center">
<tbody>
<tr>
<td align="center">
	<span class="smalltext">
                 <div class="smalltext">
<if in_array($mnxtigps_forum->forum['fid'], array(7,29)) then>DOWNLOAD <elseif> in_array($mnxtigps_forum->forum['fid'], array(30)) then>FIND</if>
                 </div>
	<a href="{$mnxtigps_links}"><img src="{$mnxtigps_img}/thumb160x120" alt="{$mnxtigps_subject}" title="{$mnxtigps_subject_text}" /></a></div>
	<br />

        <a href="{$mnxtigps_links}">{$mnxtigps_subject}</a><br />
		In: {$mnxtigps_forum}<br />
                    {$mnxtigps_views} Views<br />
         </span>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>


but that did not work .... I tried taking the <elseif> piece out to see if that was the problem but it still did not work.

Any idea what  am doing wrong?

Maybe something like this:

Code:
<if in_array($mnxtigps['fid'], array(7,29)) then>
<div>Download</div>
<elseif $mnxtigps['fid'] == 30 then>
<div>Finds</div>
<else>
<div>Images Gallery</div>
</if>


Another solution maybe, you can use image, and rename the images based on the forum id. e.g: 7.png, 29.png and etc. Then put the image tag in the template.

Hi RateU, thank you - I see I was overcomplicating things as usual. The images is a good idea - I shall try that.
Updated to v1.7, just adds a few shortcut functions.  This is mainly to prepare for the Template Conditionals plugin.
Thanks for the update!
Thanks you very much for the update, Yumi.
ZiNgA, this is brilliant... it really allows you to make your own customisation

But I've installed it, with no other plugins installed and I'm getting the error:
showthread.php(1195) : eval()'d code on line 60

This only happens on the showthread pages, and my version of MyBB is up to date (MyBB 1.6).  This happens without me even trying to change my templates, all I did was activate the plugin

EDIT: DOW!!!!    MY BAD... I had some rubbish < $stuff > in there that I was testing with.. sorry, work like a dream now, CHEERS!
fixed issue! my fault sorry!
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Reference URL's