The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

HTML Variable script isnt working *Please Help*

View previous topic View next topic Go down

HTML Variable script isnt working *Please Help*

Post by +Fusion- on July 2nd 2012, 10:17 am

Ok so im trying to put my forum (categories and forums) into a widget so i can put it on my portal page, (new design im making) , anyways heres what i have:

Code:

<script type="text/javascript">$(function() {
  var x=document.getElementById('variables').getElementsByTagName('span');
  for (i=0;i<x.length;i++) {    $('.'+x[i].id).html(x[i].innerHTML);  }
});
</script>
<div id="variables" style="display:none">
<span id="USERNAME">Using php in posts is called being a smart [Language]... Stop it</span>
<span id="USERLINK">{USERLINK}</span>
<span id="USERCOUNTPOST">{USERCOUNTPOST}</span>
<span id="LASTVISITDATE">{LAST_VISIT_DATE}</span>
<span id="CURRENTTIME">{CURRENT_TIME}</span>
<span id="UINDEX">{U_INDEX}</span>
<span id="LINDEX">{L_INDEX}</span>
<span id="NAVCATDESC">{NAV_CAT_DESC}</span>
<span id="INCSPAN">{catrow.tablehead.INC_SPAN}</span>
<span id="LFORUM">{catrow.tablehead.L_FORUM}</span>
<span id="LPOSTS">{L_POSTS}</span>
<span id="LLASTPOST">{L_LASTPOST}</span>
<span id="INCCLASS">{catrow.cathead.inc.INC_CLASS}</span>
<span id="SPACER">{SPACER}</span>
<span id="CLASSCAT">{catrow.cathead.CLASS_CAT}</span>
<span id="CATHEADINCSPAN">{catrow.cathead.INC_SPAN}</span>
<span id="CATHEADLEVEL">{catrow.cathead.LEVEL}</span>
<span id="CATDESC">{catrow.cathead.CAT_DESC}</span>
<span id="VIEWCAT">{catrow.cathead.U_VIEWCAT}</span>
<span id="CATTITLE">{catrow.cathead.CAT_TITLE}</span>
<span id="CATLEVEL">{catrow.cathead.LEVEL}</span>
<span id="CLASSROWPIC">{catrow.cathead.CLASS_ROWPIC}</span>
<span id="FORUMINCCLASS">{catrow.forumrow.inc.INC_CLASS}</span>
<span id="FORUMCLASS">{catrow.forumrow.INC_CLASS}</span>
<span id="FORUMFOLDER">{catrow.forumrow.L_FORUM_FOLDER_ALT}</span>
<span id="FORUMFOLDERIMG">{catrow.forumrow.FORUM_FOLDER_IMG}</span>
<span id="FORUMINCSPAN">{catrow.forumrow.INC_SPAN}</span>
<span id="FORUMLEVEL">{catrow.forumrow.LEVEL}</span>
<span id="VIEWFORUM">{catrow.forumrow.U_VIEWFORUM}</span>
<span id="FORUMFORUMNAME">{catrow.forumrow.FORUM_NAME}</span>
<span id="FORUMDESC">{catrow.forumrow.FORUM_DESC}</span>
<span id="LMOD">{catrow.forumrow.switch_moderators_links.L_MODERATOR}</span>
<span id="LINKSMOD">{catrow.forumrow.switch_moderators_links.MODERATORS}</span>
<span id="LLINKS">{catrow.forumrow.L_LINKS}</span>
<span id="LINKS">{catrow.forumrow.LINKS}</span>
<span id="FORUMROWTOPICS">{catrow.forumrow.TOPICS}</span>
<span id="FORUMROWPOSTS">{catrow.forumrow.POSTS}</span>
<span id="FORUMLASTPOST">{catrow.forumrow.LAST_POST}</span>
<span id="CATFOOTCLASS">{catrow.catfoot.inc.INC_CLASS}</span>
<span id="CATFOOT">{catrow.catfoot.INC_SPAN}</span>
</div>

<table width="100%" border="0" cellspacing="1" cellpadding="0" align="center">
   <tr>
      <td valign="bottom">
         <!-- BEGIN switch_user_logged_in -->
         <span class="gensmall"><span class="LASTVISITDATE"></span><br /><span class="CURRENTTIME"></span><br />
         </span>
         <!-- END switch_user_logged_in -->
         <div class="nav"><a class="nav" href="<span class="">UINDEX</span>"><span class="LINDEX"></span></a><span class="NAVCATDESC"></span></div>
      </td>
      <td class="gensmall" align="right" valign="bottom">
         <!-- BEGIN switch_user_logged_in -->
         <a class="gensmall" href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a><br />
         <a class="gensmall" href="{U_SEARCH_SELF}">{L_SEARCH_SELF}</a><br />
         <!-- END switch_user_logged_in -->
         <a class="gensmall" href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a>
      </td>
   </tr>
</table>
<!-- BEGIN catrow --><!-- BEGIN tablehead --><table class="forumline" width="100%" border="0" cellspacing="1" cellpadding="0">
   <tr>
      <th colspan="<span class="INCSPAN"></span>" nowrap="nowrap" width="100%" class="secondarytitle"> <span class="">LFORUM</span> </th>
          <th nowrap="nowrap" width="100">Threads/Posts</th>
<!-- <th nowrap="nowrap" width="50"><span class="LPOSTS"></span></th> -->
<th nowrap="nowrap" width="150"><div style="width:150px;"><span class="LLASTPOST"></span></div></th>
   </tr>
   <!-- END tablehead -->
   <!-- BEGIN cathead -->
   <tr>
      <!-- BEGIN inc -->
      <td class="<span class="INCCLASS"></span>" width="46"><img src="<span class="SPACER"></span>" height="0" width="46" /></td>
      <!-- END inc -->
      <td class="<span class="CLASSCAT"></span>" colspan="<span class="CATHEADINCSPAN"></span>" width="100%">
         <h<span class="CATHEADLEVEL"></span> class="hierarchy">
            <span class="cattitle">
               <a class="cattitle" title="<span class="CATDESC"></span>" href="<span class="VIEWCAT"></span>"><span class="CATTITLE"></span></a>
            </span>
         </h<span class="CATLEVEL"></span>>
      </td>
      <td class="<span class="CLASSROWPIC"></span>" colspan="3" align="right"> </td>
   </tr>
   <!-- END cathead -->
   <!-- BEGIN forumrow -->
   <tr>
      <!-- BEGIN inc -->
      <td class="<span class="FORUMINCCLASS"></span>" width="46"><img src="<span class="SPACER"></span>" height="0" width="46" alt="." /></td>
      <!-- END inc -->
      <td class="<span class="FORUMCLASS"></span>" align="center" valign="middle">
         <img title="<span class="FORUMFOLDER"></span>" src="<span class=FORUMFOLDERIMG""></span>" alt="<span class="FORUMFOLDER"></span>" />
      </td>
      <td class="row1 over" colspan="<span class="FORUMINCSPAN"></span>" valign="top" width="100%" height="50">
         <h<span class="FORUMLEVEL"></span> class="hierarchy">
            <span class="forumlink">
               <a class="forumlink" href="<span class="VIEWFORUM"></span>"><span class="FORUMFORUMNAME"></span></a><br />
            </span>
         </h<span class="FORUMLEVEL"></span>>
         <span class="genmed"><span class="FORUMDESC"></span></span>
         <span class="gensmall">
            <!-- BEGIN switch_moderators_links -->
            <span class="LMOD"></span><span class="LINKSMOD"></span>
            <!-- END switch_moderators_links -->
            <span class="LLINKS"></span><span class="LINKS"></span>
         </span>
      </td>
      <td class="row3" align="center" valign="middle" height="50">
  <span class="gensmall">Threads: <span class="FORUMROWTOPICS"></span><br />Posts: <span class="FORUMROWPOSTS"></span></span>
</td>
<!-- <td class="row2" align="center" valign="middle" height="50">
  <span class="gensmall"><span class="FORUMROWPOSTS"></span></span>
</td> -->
      <td class="row3 over" align="center" valign="middle" height="50">
         <span class="gensmall"><span class="FORUMLASTPOST"></span></span>
      </td>
   </tr>
   <!-- END forumrow -->
   <!-- BEGIN catfoot -->
   <tr>
      <!-- BEGIN inc -->
      <td class="<span class="CATFOOTCLASS"></span>" width="46"><img src="<span class="SPACER"></span>" height="0" width="46" /></td>
      <!-- END inc -->
      <td class="spaceRow" colspan="<span class="CATFOOT"></span>" height="1"><img src="<span class="<span class="SPACER"></span>"></span>" alt="" height="1" width="1" /></td>
   </tr>
   <!-- END catfoot -->
   <!-- BEGIN tablefoot -->
</table><img src="{SPACER}" alt="" height="5" width="1" /><!-- END tablefoot --><!-- END catrow -->

Anyways im using LGForum's variable on an html page tutorial to put the variables into the widgets, for some reason, though im doing everything correct it still ends up like this:


Any sugestions, codes, or help? i really want the forum on my portal, if not then how can i display the top posters and recent topics above forum and next to eachother on main forum page.

+Fusion-
Forumember

Male Posts : 252
Reputation : 4
Language : English
Location : Flying

http://www.xcodezz.com

Back to top Go down

Re: HTML Variable script isnt working *Please Help*

Post by genji watanabe on July 2nd 2012, 11:59 am


genji watanabe
Forumember

Male Posts : 231
Reputation : 17
Language : Html, Css, some Js and no Gfx.
Location : Malaysia

http://project-d.forumotion.com/

Back to top Go down

Re: HTML Variable script isnt working *Please Help*

Post by LGforum on July 2nd 2012, 12:53 pm

There's a number of reasons why it's not working, and it's down to the variables your using, I'd have to explain how a template engine works to explain why properly, but basically most of the variables your using are only swapped for their equivalent values on certain pages. An {catrow.blabla} will only work between the BEGIN catrow and END catrow loop.

You'd need to use a bit JavaScript to move those widgets on phpbb2.
I can't imagine it being too differcult, and iddefinitely utilise the announcement area to get it.

LGforum
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Re: HTML Variable script isnt working *Please Help*

Post by +Fusion- on July 2nd 2012, 6:11 pm

Sounds good, except i have no knowledge when it comes to javascript, I guess ill try something, if u can help me with by providing a code for me that would be great

+Fusion-
Forumember

Male Posts : 252
Reputation : 4
Language : English
Location : Flying

http://www.xcodezz.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum