Announcement

Collapse
No announcement yet.

How to retrieve {vb:raw thread.title} value on Forum PHP widget?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Forum] How to retrieve {vb:raw thread.title} value on Forum PHP widget?

    Hi

    I have a forum php widget and I need to get the post tile in a php variable like:

    $pagetitle={vb:raw thread.title};

    How can I do this ?

    Please help! thanks

  • #2
    No, you would use normal php when writing php:
    PHP Code:
    $pagetitle $thread['title']; 
    The bracketed syntax is for use in the templates.

    Please don't PM or VM me for support - I only help out in the threads.
    vBulletin Manual & vBulletin 4.0 Code Documentation (API)
    Want help modifying your vbulletin forum? Head on over to vbulletin.org
    If I post CSS and you don't know where it goes, throw it into the additional.css template.

    W3Schools <- awesome site for html/css help

    Comment


    • #3
      Thank you Lynne!!

      Hm, but $pagetitle is returning empty

      Why?

      Comment


      • #4
        And do you have that variable in the template? And did you register it for use in the template?

        Please don't PM or VM me for support - I only help out in the threads.
        vBulletin Manual & vBulletin 4.0 Code Documentation (API)
        Want help modifying your vbulletin forum? Head on over to vbulletin.org
        If I post CSS and you don't know where it goes, throw it into the additional.css template.

        W3Schools <- awesome site for html/css help

        Comment


        • #5
          No Lynne, I have no declared this variable, where should I do ? Please tell me and I do!

          This variable is to be used only inside the forum widget block.

          thanks

          Comment


          • #6
            Cellarius wrote a really good article that should help you in declaring the variable - [vB4] Rendering templates and registering variables - a short guide I also released a widget over on vb.org where I had to register my variables for use, so you may want to take a look at my widget over there.

            Please don't PM or VM me for support - I only help out in the threads.
            vBulletin Manual & vBulletin 4.0 Code Documentation (API)
            Want help modifying your vbulletin forum? Head on over to vbulletin.org
            If I post CSS and you don't know where it goes, throw it into the additional.css template.

            W3Schools <- awesome site for html/css help

            Comment


            • #7
              What about vBulletin 3.8?
              The variable returns empty there, as well.
              ~
              ~ If you're using vB, you need a good host! Read my web hosting reviews.
              ~
              ~ Forum: Digital Video / Digital Photo / Web Design @ digitalFAQ.com
              ~ Forum: DVD & Blu-ray Collecting @ TVPast.org
              ~

              Comment


              • #8
                Which varible? Also vBulletin.org, or the vB3 subforum would be better along with what you're actutally trying to do.

                Comment


                • #9
                  The same as the earlier poster: $variable = $thread['title']; returns nothing.

                  I'm wanting to make a change in the template -- specifically the page title shown in the <title></title> tags.

                  $thread[title] is part of the title.

                  What I'm attempting to do is capitalize each word using ucwords(), but adding PHP into the <title> doesn't work.

                  I thought adding a quick plugin would solve this, and I could instead call up the alternate variable ($captitle) in the <title>.

                  Before adding ucwords(), I thought I'd try a simple swap, using a new plugin with this code:
                  Code:
                  $captitle = $thread['title'];
                  The title ends up removed.
                  I tried it on both the global_start and showthread_start -- no effect.

                  I didn't ask on vB.org because non-basic vB3 posts never seem to get replies anymore.

                  I replied here because the earlier response was to not forget to register in vB4. However, vB3 didn't need to be registered, and yet it still isn't working. (The previous poster also never replied again, so there's a chance it wasn't working for him in vB4 even after it was registered.)
                  ~
                  ~ If you're using vB, you need a good host! Read my web hosting reviews.
                  ~
                  ~ Forum: Digital Video / Digital Photo / Web Design @ digitalFAQ.com
                  ~ Forum: DVD & Blu-ray Collecting @ TVPast.org
                  ~

                  Comment


                  • #10
                    If you want to use $captitle in the template, then you will need to first register the variable for use in the template.

                    The best place to be asking for help with this is over on vbulletin.org, the modification site.

                    Please don't PM or VM me for support - I only help out in the threads.
                    vBulletin Manual & vBulletin 4.0 Code Documentation (API)
                    Want help modifying your vbulletin forum? Head on over to vbulletin.org
                    If I post CSS and you don't know where it goes, throw it into the additional.css template.

                    W3Schools &lt;- awesome site for html/css help

                    Comment


                    • #11
                      Originally posted by kpmedia View Post
                      What about vBulletin 3.8?
                      The variable returns empty there, as well.
                      3.8 doesnt have widgets.
                      Baby, I was born this way

                      Comment

                      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                      Working...
                      X