Jump to content


Photo

PHP, how I hate thee.


  • Please log in to reply
2 replies to this topic

#1 Byakuya Kuchiki

Byakuya Kuchiki

    Runs with Scissors

  • Members
  • 2,523 posts
  • Location:The Real World

Posted 29 January 2012 - 08:28 AM

Hello all,

Skinning for Ipb 3.2, and am running into a php variables problem. Not sure why the problem arises, as I can definitely say I'm not versed in <if test=""> tags. What I'm attempting to do is define if a topic has an admin post anywhere within it, not just first or last post, and then return a true/false that can be used to generate an [Admin] tag in forum view to denote that an admin has started/replied to a topic. So, here's the basic code:

<if test="hastopics:|:$data[member_group_id]==4">
<span class='ipsBadge ipsBadge_red'>Admin</span>&nbsp;
</if>

This is placed into the Look and Feel>Skin>Forum View>topic template. I found that, while it does kind of work, it only marks topics in which an administrator is the last person to post within any given topic. It apparently doesn't call the topic to find out if the topic has any admin posts anywhere else other than in the last post position. Now, I did find this:

<a href="{parse url="app=forums&amp;module=extras&amp;section=stats&amp;do=who&amp;t={$data['tid']}" base="public"}" onclick="return ipb.forums.retrieveWhoPosted( {$data['tid']} );">{parse format_number="$data['posts']"} <if test="replylang:|:intval($data['posts']) == 1">{$this->lang->words['reply']}<else />{$this->lang->words['replies']}</if></a>

Which is a function that displays an X Replies link that when a user clicks on it, it loads a lightbox along with all the users who have replied to that topic. However, I realize that the {parse url} function is incorrect syntax for an <if test> tag. Anyways, screenshot of first attempt below.

Posted Image

Thanks for any help, much appreciated,
-Nowe

Posted Image


#2 Phil

Phil

    Force Majeure

  • Network Leaders
  • 7,976 posts
  • Location:Switzerland
  • Projects:Revora, C&C:Online
  •  Thought Police
  • Division:Revora
  • Job:Network Leader
  • Donated
  • Association

Posted 29 January 2012 - 12:19 PM

Sounds like it's more of an IPB template logic problem than a PHP problem. I'll take a look later today, but no promises. Maybe you'd get more help if you posted in the official IPS support forums. It's frequented by people who do pretty heavy IPB development.

revorapresident.jpg
My Political Compass

Sieben Elefanten hatte Herr Dschin
Und da war dann noch der achte.
Sieben waren wild und der achte war zahm
Und der achte war's, der sie bewachte.


#3 Pasidon

Pasidon

    Splitting Hares

  • Network Admins
  • 9,126 posts
  • Location:Indiana
  • Projects:Writing Words With Letters
  •  I Help
  • Division:Community
  • Job:Community Admin

Posted 31 January 2012 - 04:56 PM

I think he gave up on it anyway... just in case you were stumped in a pile of work for this, Sith.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users