rejetto forum

PROBLEM : Load Modules Automatically

Roessi · 6 · 4083

0 Members and 1 Guest are viewing this topic.

Offline Roessi

  • Tireless poster
  • ****
    • Posts: 107
    • View Profile
:) since rejetto implemented the dir cmd ... i should be able to load all the modules automatically ... so i gave it a try and wrote a script to do this ... :

function to load the modules :
Code: [Select]

{.if|{.!modules.}|{:
< t d width="175" valign="top" id="moduleCol" >
< s p a n  id="specialBox" >< /s p a n >

{.for each|#module|{.dir|template/rawr_default/modules/.}|{:

{.if not| {.pos |false|{.for each|#restr|none|{.load|template/rawr_default/modules/{.^#module.}/restrictions.txt.}|{:
{.^checkrestriction|{.^#restr.}|{.^#module.}.}
:}.}.}|{:
{.^modhtml|{.^#module.}.}
:}.}



:}.}
< / t d >
:}.}

checkrestrictions functions:
Code: [Select]
{.set|checkrestrictions|{:

{.switch|$1|,|
local|{: {.if|{.match|127.*;10.*;192.168.*|%ip%.}|true|false .} :}|
ggk|{:{.if|{.{.^ggk|$2=true.}.}|true|false.}:}|
lgd|{:{.if|%user%|true|false.}:}|
off|{:false:}|
none|{:false:}|true

.}

:}.}

modhtml function :

Code: [Select]
{.set|modhtml|{:
< d i v class="module" >
< d i v class="modHeading" >
< s p a n  >
< a h r e f ="javascript:pinModule('$1');" id="$1_Link" title="{.!lv_hideTitle.}" >< i mg
class="hide" src="/template/{.!theme.}/images/hide.gif" align="top" alt=""/ >
< n o s c r i p t >< i mg src="/template/rawr_default/images/spacer.gif" width="8" align="top" alt=""/ >< /n o s c r i p t >
< / a >
< / s p a n >
{.load|/template/rawr_default/modules/$1/title.txt.}
< / d i v >
< d i v class="modContent" id="$1" >
{.load|/template/rawr_default/modules/$1/modcontent.txt.}
< / d i v >
< / d i v >
:}.}



... and the problem is ... all modules are displayed ... but the checkrestriction function returns neither false nor true ...
and the bigger problem :

none of the macros in the modules beign loaded are executed ...  and i dunno why ^^

would be great if anyone could take a look at the code and tell if he could spot the problem ^^

thx in advance


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
menu > debug > enable macros.log

it's not easy to read, but there should be the answer to your problem.
if you cannot find, then consider posting the file here.


Offline Roessi

  • Tireless poster
  • ****
    • Posts: 107
    • View Profile
um it seems that the for each command just doesnt execute the macros when it loads it from a file ...
tried it with a few other simpler examples and they all just didnt got executet ... dont know why .


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile

Offline Roessi

  • Tireless poster
  • ****
    • Posts: 107
    • View Profile
umm i dont know at which point its the problem ... it just seems at some point all the macros are treated just as plain text : - /
at line 520 theres the first process of the for each function :) but i dont find anything : - /

attached :

template

macros.log


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
around line 520, it is is still evaluating the "if".
at line 555 you can see the "for" taken for execution.
at line 566 its unrolling. [1]
i hope this will help you reading the log.
maybe i should make it clearer, like using
"INPUT>" and
"OUTPUT<"
instead of ">" and "<"


[1] at the moment "for"s are unrolled, but i think i will change this. it will be execution step-by-step, like for the "while".