No announcement yet.

Making a new template field

  • Filter
  • Time
  • Show
Clear All
new posts

  • Making a new template field

    Hi there,

    I had a quick question and I hope that someone from here will be able to help me. I have created a small addon for my vbulletin, and now I'm stock on one part which has been bugging me, cause I can't figure it out.

    What I want to know is that how could I make a form field in the admincp which accepts template codes?

    For example, you can convert a form field and make it accept html by making a code like this
    $forum['example'] = convert_to_valid_html($forum['example']);
    Now the problem is that I have created an extra form field to my "style manager under the "phpinclude" form field, but the form that I have created only accepts html.

    The reason that I'm asking is because I want to insert variables in this field but because of this problem, it does not read the variables,

    thank you for your time,
    sean s.

  • #2
    I am not sure I understand your question. Are you trying to use the contents of a template in another template? Are you having problems with a variable not parsing in a template?


    • #3
      Yes that's pretty much the problem. What I did is that in the "common templates" area, I added a new field so that I could add code and have that code displayed in a part of my website, but the problem is that the form field only inserts html and does not prase any of the variables that I submit to it.

      Do you know a way that I could get around this maybe?


      • #4
        A custom field? Is this a file modification? Where are you defining the variables and in what template are you referencing them?


        • #5
          Ok here is what I did, to create what I basically wanted, *I'm not taking credit for this code*

          First thing I did was I ran a sql query kind of like this,
          [code]ALTER TABLE `forum` ADD `forumbanner` MEDIUMTEXT NOT NULL AFTER `description`;[code]

          and then I added to admin/template.php

           print_textarea_row(Header, 'forum[forumbanner]', $forum['forumbanner']);
          $forum['forumbanner'] = convert_to_valid_html($forum['forumbanner']);
          Then I added this to my forumdisplay template
          The problem is that everytime I add in a simple html code or just plain text, it shows everything where I want it on the template, but everytime, in the custom field I add a variable from a php code that I have in the phpinclude template, it doesn't prase/read the variable in the template.


          • #6
            Because this involves file modifications, I recommend you post on We can't support custom code here.


            • #7
              oh ok Jake, thanks anyways for the try


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