rejetto forum

server-side scripting

gogi1000 · 14 · 19292

0 Members and 1 Guest are viewing this topic.

Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
i have a question. is template the Rawr Template Modules Mod v.0.1.3.m.1.5 or hfs http server have support for server side scripting. i want that my listbox on page get values from external file. if YES, can you give me some instruction?

thank's


Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
i solved problem with code
<script type="text/javascript">
$(document).ready(function(){
    $("select").ready(function(){
        $("#lista").load("http://localhost/template/pitanja-b.txt");
    });
});
   </script>

<select id="lista"   >
           
         </select>

but how i resolve that if is user memeber of group for example the budzet, he load file pitanja-b.txt, but if he is memeber of group the lokal, he load file the pitanja-l.txt?

thanks


Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
i try with next code

<script type="text/javascript">
      var theme="{.!theme.}";
      var mod_statistics="{.!mod_statistics.}";
      //Language Strings
      var lv_hideTitle="{.!lv_hideTitle.}";
      var lv_showTitle="{.!lv_showTitle.}";
      
   
   
   function change(obj) {


    var selectBox = obj;
    var selected = selectBox.options[selectBox.selectedIndex].value;
    var textarea = document.getElementById("skriveno");

    if(selected != '0'){
       
      document.getElementById("skriveno").disabled = false;
    }
   
}
  {.if|{.get account|%user%|member of|#budzet#.}|
  $(document).ready(function(){
    $("select").ready(function(){
        $("#lista").load("http://localhost/template/pitanja-budzet.txt");
    });
});
/if.}
 {.if|{.get account|%user%|member of|#lokal#.}|
  $(document).ready(function(){
    $("select").ready(function(){
        $("#lista").load("http://localhost/template/pitanja-lokal.txt");
    });
});
/if.}
{.if|{.get account|%user%|member of|#ooso#.}|
  $(document).ready(function(){
    $("select").ready(function(){
        $("#lista").load("http://localhost/template/pitanja-ooso.txt");
    });
});
/if.}
   </script>

but i receive elements of list from text file the pitanja-ooso.txt. any user logged every time i receive from the pitanja-ooso.txt


Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
i tryed with next code

   {.switch|{.%user%|member of.}|,|
  budzet|{:<script type="text/javascript">$(document).ready(function(){
    $("select").ready(function(){
        $("#lista").load("http://localhost/template/pitanja-budzet.txt");
    });
}); </script>:}|
   lokal|{:<script type="text/javascript">$(document).ready(function(){
    $("select").ready(function(){
        $("#lista").load("http://localhost/template/pitanja-lokal.txt");
    });
});</script>:}
 ooso|{:<script type="text/javascript">$(document).ready(function(){
    $("select").ready(function(){
        $("#lista").load("http://localhost/template/pitanja-ooso.txt");
    });
});</script>:}
/switch.}

but nothing


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2063
    • View Profile
in your message of Today at 08:27:01
you omitted the {: :] inside IF macro


in your message of  Today at 11:14:51
you macro with member of is wrong 

{.switch|{.%user%|member of.}|,|  --->> {.switch|{.get account|%user%|member of.}|,|


Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
{.switch|{.%user%|member of.}|,|  --->> {.switch|{.get account|%user%|member of.}|,|

where is error? how i correct them?


Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
i set {.switch|{.get account|%user%|member of.}|,| instead {.switch|{.%user%|member of.}|,| but all is same i receive elements of list from text file the pitanja-ooso.txt. any user from any group logged every time i receive from the pitanja-ooso.txt

my code is now

{.switch|{.get account|%user%|member of.}|,|
  #budzet#|{:<script type="text/javascript">$(document).ready(function(){
    $("select").ready(function(){
        $("#lista").load("http://localhost/template/pitanja-budzet.txt");
    });
}); </script>:}|
   #lokal#|{:<script type="text/javascript">$(document).ready(function(){
    $("select").ready(function(){
        $("#lista").load("http://localhost/template/pitanja-lokal.txt");
    });
});</script>:}
 #ooso#|{:<script type="text/javascript">$(document).ready(function(){
    $("select").ready(function(){
        $("#lista").load("http://localhost/template/pitanja-ooso.txt");
    });
});</script>:}
/switch.}
« Last Edit: August 05, 2016, 06:01:22 AM by gogi1000 »


Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
i solved problem with this code

{.if|{.member of|budzet.}|
  {:<script type="text/javascript">$(document).ready(function(){
    $("select").ready(function(){
        $("#lista").load("http://localhost/template/pitanja-budzet.txt");
    });
});</script>:}|
{.if|{.member of|lokal.}|
  {:<script type="text/javascript">$(document).ready(function(){
    $("select").ready(function(){
        $("#lista").load("http://localhost/template/pitanja-lokal.txt");
    });
});</script>:}|{.if|{.member of|ooso.}|
  {:<script type="text/javascript">$(document).ready(function(){
    $("select").ready(function(){
        $("#lista").load("http://localhost/template/pitanja-ooso.txt");
    });
});</script>:}
/if.}
/if.}
/if.}

thank's


Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
again problem. this code works in internet explorer and chrome but not works in firefox.

{.if|{.member of|budzet.}|
  {:<script type="text/javascript">$(document).ready(function(){
   
        $("#lista").load("/template/pitanja-budzet.txt");
   });</script>:}|
{.if|{.member of|lokal.}|
  {:<script type="text/javascript">$(document).ready(function(){
   
        $("#lista").load("/template/pitanja-lokal.txt");
 
});</script>:}|{.if|{.member of|ooso.}|
  {:<script type="text/javascript">$(document).ready(function(){
   
        $("#lista").load("/template/pitanja-ooso.txt");
 
});</script>:}|{.if|{.member of|JAVNA.}|
  {:<script type="text/javascript">$(document).ready(function(){
   
        $("#lista").load("/template/pitanja-javna_preduzeca.txt");
 
});</script>:}|{.if|{.member of|NBS.}|
  {:<script type="text/javascript">$(document).ready(function(){
 
        $("#lista").load("/template/pitanja-nbs.txt");
   
});</script>:}
/if.}
/if.}
/if.}
/if.}
/if.}

where is problem?


Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
when i start debugger in firefox and i click on list i receive data from text file like on picture but i cannot see them in browser. where is problem?


Offline bmartino1

  • Tireless poster
  • ****
    • Posts: 911
  • I'm only trying to help i mean no offense.
    • View Profile
    • My HFS Google Drive Shared Link
witch ever source you were looking at, had data not be parsed. i would assume that a "character set was not defined, or you were viewing a picture.

i would recommend throwing that code through the validator... may help you debug the issue:
https://validator.w3.org/#validate_by_input
Files I have snagged and share can be found on my google drive:

https://drive.google.com/drive/folders/1qb4INX2pzsjmMT06YEIQk9Nv5jMu33tC?usp=sharing


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2063
    • View Profile
Quote
when i start debugger in firefox and i click on list i receive data from text file like on picture but i cannot see them in browser. where is problem?

Can you verify that your txt files are not stored as unicode

already your code is not correct, missing macroquotes in parts "ELSE"  (if .. then ... else ...)


for correction, use the following content

Quote
{.if|{.member of|budzet.}| {:<script type="text/javascript">$(document).ready(function(){
           $("#lista").load("/template/pitanja-budzet.txt");});</script>:}
 |{:{.if|{.member of|lokal.}| {:<script type="text/javascript">$(document).ready(function(){
        $("#lista").load("/template/pitanja-lokal.txt");});</script>:}
 |{:{.if|{.member of|ooso.}| {:<script type="text/javascript">$(document).ready(function(){
        $("#lista").load("/template/pitanja-ooso.txt");});</script>:}
 |{:{.if|{.member of|JAVNA.}| {:<script type="text/javascript">$(document).ready(function(){
        $("#lista").load("/template/pitanja-javna_preduzeca.txt");});</script>:}
 |{:{.if|{.member of|NBS.}| {:<script type="text/javascript">$(document).ready(function(){
        $("#lista").load("/template/pitanja-nbs.txt");});</script>:}
 /if.}:}
 /if.}:}
 /if.}:}
 /if.}:}
/if.}

by creating a generic macro, we get a more concise code

Quote
{.set|loadthefile|{:<script type="text/javascript">$(document).ready(function(){$("#lista").load("/template/$1.txt");});</script>:}/set.}

{.if|{.member of|budzet.}|{:{.^loadthefile|pitanja-budzet.}:}
 |{:{.if|{.member of|lokal.}|{:{.^loadthefile|pitanja-lokal.}:}
 |{:{.if|{.member of|ooso.}|{:{.^loadthefile|pitanja-ooso.}:}
 |{:{.if|{.member of|JAVNA.}|{:{.^loadthefile|pitanja-javna_preduzeca.}:}
 |{:{.if|{.member of|NBS.}|{:{.^loadthefile|pitanja-nbs.}:}
 /if.}:} /if.}:} /if.}:} /if.}:}
/if.}

to understand the latest code, look at the wiki : Variables and functions  set | A | B    and  call | A | B | C | ...
http://www.rejetto.com/wiki/index.php?title=HFS:_scripting_commands


Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
when i changed text file from UNICODE to ANSI all is ok. there's option for unicode format of text file?


Offline gogi1000

  • Occasional poster
  • *
    • Posts: 44
    • View Profile
problem is solved. i made encoding text files to ANSI with notepad++ and when i load text file from web browser i receive unicode characters.thanks.

i have one more question about hide upload button. i want hiding of this button when i placed in folder where's files. when i placed on level where're folders i want that show this button.

how?