Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Very new at PHP
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #11
RE: Very new at PHP
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?


Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
05-17-2011 06:19 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #12
RE: Very new at PHP
Only put PHP code within <?php ... ?> tags.  In other words, do not put <?php ... ?> tags around your <template ...> call.

My Blog
05-17-2011 07:08 PM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #13
RE: Very new at PHP
(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.


Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
(This post was last modified: 05-17-2011 11:56 PM by Sama34.)
05-17-2011 07:24 PM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #14
RE: Very new at PHP
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.

05-18-2011 04:45 AM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #15
RE: Very new at PHP
Thank  you RateU, i will try it Biggrin and i will change it to $postcounter

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
05-18-2011 09:14 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Gypaete Offline
Member
***
Posts: 82
Joined: Aug 2010
Post: #16
RE: Very new at PHP
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)

[Image: selenab.png]
05-18-2011 09:19 PM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #17
RE: Very new at PHP
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.


Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
05-25-2011 11:36 PM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #18
RE: Very new at PHP
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

05-26-2011 01:56 AM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #19
RE: Very new at PHP
Thank you RateU, I use another template because It is easy to understand my own code that way Biggrin

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
05-26-2011 03:26 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #20
RE: Very new at PHP
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


Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
(This post was last modified: 06-19-2011 09:16 PM by Sama34.)
06-19-2011 08:51 PM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: