Author Topic: server-side scripting  (Read 3241 times)

0 Members and 1 Guest are viewing this topic.

Offline gogi1000

  • Experienced poster
  • ***
  • Posts: 32
    • View Profile
server-side scripting
« on: August 03, 2016, 10:03:21 AM »
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

  • Experienced poster
  • ***
  • Posts: 32
    • View Profile
Re: server-side scripting
« Reply #1 on: August 04, 2016, 06:33:15 AM »
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

  • Experienced poster
  • ***
  • Posts: 32
    • View Profile
Re: server-side scripting
« Reply #2 on: August 04, 2016, 07:27:01 AM »
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

  • Experienced poster
  • ***
  • Posts: 32
    • View Profile
Re: server-side scripting
« Reply #3 on: August 04, 2016, 10:14:51 AM »
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
  • Insane poster
  • *****
  • Posts: 1830
    • View Profile
Re: server-side scripting
« Reply #4 on: August 04, 2016, 04:32:25 PM »
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

  • Experienced poster
  • ***
  • Posts: 32
    • View Profile
Re: server-side scripting
« Reply #5 on: August 05, 2016, 04:49:28 AM »
{.switch|{.%user%|member of.}|,|  --->> {.switch|{.get account|%user%|member of.}|,|

where is error? how i correct them?

Offline gogi1000

  • Experienced poster
  • ***
  • Posts: 32
    • View Profile
Re: server-side scripting
« Reply #6 on: August 05, 2016, 05:58:11 AM »
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

  • Experienced poster
  • ***
  • Posts: 32
    • View Profile
Re: server-side scripting
« Reply #7 on: August 05, 2016, 01:29:07 PM »
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

Follow members gave a thank to your post:


Offline gogi1000

  • Experienced poster
  • ***
  • Posts: 32
    • View Profile
Re: server-side scripting
« Reply #8 on: August 17, 2016, 06:08:53 AM »
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

  • Experienced poster
  • ***
  • Posts: 32
    • View Profile
Re: server-side scripting
« Reply #9 on: August 17, 2016, 09:50:10 AM »
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

  • Insane poster
  • *****
  • Posts: 785
  • I'm only trying to help i mean no offense.
    • View Profile
    • none - google translate
Re: server-side scripting
« Reply #10 on: August 17, 2016, 01:35:19 PM »
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
I'm only trying to help i mean no offense.
thank you for your time and patience,
Bmartino1

Offline Mars

  • Operator
  • Insane poster
  • *****
  • Posts: 1830
    • View Profile
Re: server-side scripting
« Reply #11 on: August 17, 2016, 02:15:24 PM »
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

  • Experienced poster
  • ***
  • Posts: 32
    • View Profile
Re: server-side scripting
« Reply #12 on: August 18, 2016, 05:36:08 AM »
when i changed text file from UNICODE to ANSI all is ok. there's option for unicode format of text file?

Offline gogi1000

  • Experienced poster
  • ***
  • Posts: 32
    • View Profile
Re: server-side scripting
« Reply #13 on: August 18, 2016, 10:45:48 AM »
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?