MyBB Hacks

Full Version: Very new at PHP
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
Ok, Am I allowed to post other problem? I don't want to make another thread for this as i think it is not exactly necessary :/

I want to call a template using:

PHP Code:
<?php
<template name>
?>


Template name was created, and the content is visible, but at the end it shows up ?>

Any idea why?

Only put PHP code within <?php ... ?> tags.  In other words, do not put <?php ... ?> tags around your <template ...> call.
(05-17-2011 07:08 PM)ZiNgA BuRgA Wrote: [ -> ]Only put PHP code within <?php ... ?> tags.  In other words, do not put <?php ... ?> tags around your <template ...> call.

All right. Next time i will double check before asking for help. Thank you ZiNgA BuRgA Biggrin

Edit:
I want to show different content for the fist post, so that it looks different.

I tryed this at potbit:

PHP Code:
<if $post['pid'] == 1 then>
first post
<else>
any reply
</if>


I worked, but it is possible to do it so that the first post, third one, 5th and so on... have opposite look that any other?

Something like this:

PHP Code:
<if $post['pid'] == odd# then>
first post
<else>
any reply
</if>


Thanks.

For odd or even:
I think you can use modulus or by checking the binary of the number.
For this, I think the easiest way is using the $postcounter.
Thank  you RateU, i will try it Biggrin and i will change it to $postcounter
Hi, proof this:
<if in_array($GLOBALS['mybb']->user['usergroup'], array(GID's)) then>
<else>
Other groups
</if>

For example:
<if in_array($GLOBALS['mybb']->user['usergroup'], array(1,7)) then>
Guest and banned
<else>
Registred, Admins, Mod's, etc..
</if>

I used this in SekaiManga x)
I' trying to make user viewing private messages to see the postbit diffetently, i tryed this and it looks like it worked:

Code:
<if THIS_SCRIPT == "private.php" then>
<template postbit_pm>
<else>
regular postbit...
</if>


Just want to know if it is right or not, thanks.

I think it's OK. I did it like that before. But I don't call a new template, I just use two layout in my original postbit template Biggrin
Thank you RateU, I use another template because It is easy to understand my own code that way Biggrin
Now I want to show '[Closed]' to any closed thread, but the problem is that is the thread is sticky then it shows both. I tried this and it worked:

PHP Code:
<if $thread['closed'] then>
<span style="color:red;">[Cerrado]</span>
<else>
{$prefix}
</if>


The problem is if the thread is also 'sticky' it is replaced by [Closed], I want the thread to show 'sticky' if the thread is sticky and closed, and '[Closed]' if the thread is close.

Tanks in advance Smile

Pages: 1 2 3 4 5 6
Reference URL's