* The_Netter Can anybody help me with hiding part of page with comment method using xt variables? I want to reval som page part when a user enters his nick and clicks a submit button
2015-01-03 15:05 (edited 2015-01-03 15:09 by The_Netter ) · (0)
* Graham * The_Netter There are probably better ways of doing this now using xtscript but I created this method about 5 years ago before xtscript was created
basically in your form you have hidden inputs
<input type="hidden" name="hide1" value=""/>
and if required
<input type="hidden" name="hide2" value="!--"/>
then your hidden code to show after submit is like
<{_$hide1|!--}div>some text or code</div{_$hide1|--}>
or the reverse
<{_$hide2|}div>some text or code</div{_$hide2|}>
2015-01-03 15:59 (edited 2015-01-03 16:00 by Graham ) · (0)
* The_Netter * Graham Thanks. It looks like the xtscript method will be better. What basics are involved in writing the script?
2015-01-03 17:07 · (0)
* Graham * The_Netter The basics to do the same thing would be something like this
you have your form which is also in the script
and for example it sets a variable called username
This script also sets a cookie to remember the username between visits
demo of this script HERE
<!--parser:xtscript-->
# Get the username from the form
get username

# Check for a cookie or default to the entered name from the form
var $username = call cookie::get $name=mycookie;$default=$username

# If the username is set refresh or create the cookie and output the username
if $username
call cookie::set $name=mycookie; $val=$username; $expire=99999999;$force_current=1;
print <span class="">$username</span>
else

# Show the form
var $self=<xt:url />
print {{
<form action="$self" method="post">
<input name="username" />
<input type="submit" />
</form>}}
endif
<!--/parser:xtscript-->

Copy code

first time it shows the form
second time or on return visits it shows the username
2015-01-03 18:15 (edited 2015-01-03 19:15 by Graham ) · (0)
* The_Netter * Graham Ok thanks I will use it but my aim though was to create a css generator and hide the textarea for copying css code, untill the values are inputed into the generating form. Seems it getting complex, how can I do it with xtscript? I already know how to create the generator, just wish to hide the copy textarea.
2015-01-03 19:43 (edited 2015-01-03 19:52 by The_Netter ) · (0)
* Graham * The_Netter For that the first method may be easier just set the hide1 variable in the form and wrap your textarea in the div
2015-01-03 19:50 (edited 2015-01-03 19:52 by Graham ) · (0)
* The_Netter * Graham Oh! Thanks
2015-01-03 19:55 · (0)
* XTMEDIA * Graham What xtscript code to clean up a cookie?
2015-01-27 12:22 · (0)
* Graham * XTMEDIA call cookie::delete $name=mycookie;
2015-01-30 10:03 · (0)
* XTMEDIA * Graham ok, mr. Thank's...
2015-01-30 16:58 · (0)

Online: Guests: 1