Results 1 to 13 of 13

Thread: Add "in $forum[title]" to byline in News

  1. #1

    Default Add "in $forum[title]" to byline in News

    Here's what I've added in to the adv_portal_newsbits in order to try to get this (new code in red):

    Code:
    		$news[dateposted] - <phrase 1="$vboptions[bburl]/member.php?$session[sessionurl]u=$news[postuserid]" 2="$news[postusername]">$vbphrase[by_x]</phrase>  in <a href="/forums/forumdisplay.php?$session[sessionurl]f=$forum[forumid]"><strong>$forum[title]</strong></a>
    I also added:

    vbphrase
    forum[title]
    vboptions

    To the Portal Output Global Variables as well, I'm assuming that was correct.

    Any thoughts?

  2. #2

    Default Re: Add "in $forum[title]" to byline in News

    Any ideas?

    www.sociocide.com <-- for reference.

  3. #3

    Default Re: Add "in $forum[title]" to byline in News

    Checking in again. Seems like this would be a simple thing.

  4. #4
    Join Date
    Nov 2005
    Location
    Kent, UK
    Posts
    26

    Default Re: Add "in $forum[title]" to byline in News

    You can't just use $forum[something] because it doesn't look like $forum is ever set in news.php. You can get the forumid by using $news[forumid], but I can't see that the forum title is ever fetched from the database for you to be able to display it.

  5. #5

    Default Re: Add "in $forum[title]" to byline in News

    Hrm. What if I include global.php in the template? Would that work?

  6. #6
    Join Date
    Nov 2005
    Location
    Kent, UK
    Posts
    26

    Default Re: Add "in $forum[title]" to byline in News

    You can't include a PHP file in a template because you are limited what PHP you can execute in a template I believe. Global.php is already included in cmps_index.php anyway.

    You'll need to see if the forum name is already available to you in a vBulletin variable somewhere, and if it isn't you'll need to modify the code to fetch it from the database.

  7. #7

    Default Re: Add "in $forum[title]" to byline in News

    Crap. I guess I'd better actually learn PHP then.

  8. #8

    Default Re: Add "in $forum[title]" to byline in News

    Tried this, noticed it in another hack here. For the record, it still didn't work:

    Code:
    		<span style="white-space: nowrap;">$news[dateposted] - <phrase 1="$vboptions[bburl]/member.php?$session[sessionurl]u=$news[postuserid]" 2="$news[postusername]">$vbphrase[by_x]</phrase> in 
    <if condition="$news[forumid] == '89'">
    <a href="forumdisplay.php?f=39" />Ground Zero</a>
    </if>
    <if condition="$news[forumid] == '81'">
    <a href="forumdisplay.php?f=25" />Music, Movies, and Mayhem</a>
    </if>
    <if condition="$news[forumid] == '73'">
    <a href="forumdisplay.php?f=60" />Geekdom</a>
    </if>
    <if condition="$news[forumid] == '75'">
    <a href="forumdisplay.php?f=27" />News</a>
    </if>
    <if condition="$news[forumid] == '79'">
    <a href="forumdisplay.php?f=63" />Reviews</a>
    </if>
    </span>

  9. #9

    Default Re: Add "in $forum[title]" to byline in News

    Hey, what do you know... it's working.

  10. #10
    Join Date
    Mar 2004
    Location
    A galaxy far, far away...
    Posts
    6,609

    Default Re: Add "in $forum[title]" to byline in News

    Hard-coding the titles seems like a hard-way of doing it. Try this...

    Edit your /modules/news.php file and look for (around line 113)..
    Code:
    LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = thread.firstpostid)
    ... and below it add:
    Code:
    LEFT JOIN " . TABLE_PREFIX . "forum AS forum ON (forum.forumid = thread.forumid)
    Look for (around line 111)...
    Code:
        " . iif ($mod_options['portal_news_showsubscribed'] AND $vbulletin->userinfo['userid'] , ', NOT ISNULL(subscribethread.subscribethreadid) AS subscribed ') . "
    ... and change it to:
    Code:
        " . iif ($mod_options['portal_news_showsubscribed'] AND $vbulletin->userinfo['userid'] , ', NOT ISNULL(subscribethread.subscribethreadid) AS subscribed ') . ',forum.title as forumtitle,forum.forumid as forumid' . "
    Modify your template named "adv_portal_newsbits" and find...
    Code:
     $news[dateposted] - <phrase 1="$vboptions[bburl]/member.php?$session[sessionurl]u=$news[postuserid]" 2="$news[postusername]">$vbphrase[by_x]</phrase>
    ... and change it to:
    Code:
     $news[dateposted] - <phrase 1="$vboptions[bburl]/member.php?$session[sessionurl]u=$news[postuserid]" 2="$news[postusername]">$vbphrase[by_x]</phrase><if condition="$news['forumid'] AND $news['forumtitle']"> in <a href="$vboptions[bburl]/forumdisplay.php?f=8" target="_self">$news[forumtitle]</a></if>
    Final step: Convince Brian to make this a default option!

    You should end up with something like this... http://www.coolscifi.com. Check the line where the user name is.

  11. #11
    Join Date
    Jan 2004
    Location
    Georgia, USA
    Posts
    34,466

    Default Re: Add "in $forum[title]" to byline in News

    Actually, there's no reason for all of that... Try $news[forumtitle].

  12. #12
    Join Date
    Mar 2004
    Location
    A galaxy far, far away...
    Posts
    6,609

    Default Re: Add "in $forum[title]" to byline in News

    Quote Originally Posted by Brian View Post
    Actually, there's no reason for all of that... Try $news[forumtitle].
    Darn it, I must've missed that it's already being pulled in the query. Aaaagghhhh!!! {bangs head on keyboard}

  13. #13

    Default Re: Add "in $forum[title]" to byline in News

    I'll have to go back and fix that then. Thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How To Remove "Replies" and "Views" from News Archives
    By DMH in forum "How Do I..." Questions
    Replies: 5
    Last Post: 10-29-2006, 05:12 AM
  2. How To: add a title to "News"?
    By blkatt in forum "How Do I..." Questions
    Replies: 2
    Last Post: 07-02-2005, 10:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •