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
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|}>
The_Netter
Graham Thanks. It looks like the xtscript method will be better. What basics are involved in writing the script?
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
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.
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
XTMEDIA
Graham What xtscript code to clean up a cookie?
Graham
XTMEDIA call cookie::delete $name=mycookie;