Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Username in Static home.html

Quote Reply
Username in Static home.html
hi,
i need the <%Username%>-tag in all my static pages, because i want a user-login form being displayed on all pages.

but i don't know how. i always get the error "unknown tag 'username' ".

is there perhaps a posibility to define "username" as a template global or something like that ?

when the answer is yes, what do i have to do ?


Quote Reply
Re: Username in Static home.html In reply to
 
I think you use: <%Links::Utils::load_user%>
at the top of static templates to load user information for link owners.


Eraser:
Insight Eye
http://www.insighteye.com/
Quote Reply
Re: Username in Static home.html In reply to
sorry, but doesn't work.

error : "This tag can only be used on link.html or detailed.html templates."



Quote Reply
Re: Username in Static home.html In reply to
uups,

of course a template global is nonsense... but there should be another possibility....

Quote Reply
Re: Username in Static home.html In reply to
Hi,

I'm not sure if you can use it on static pages, have you tried it dynamically?

Try adding the tag to your template again, and call the pages dynamically with page.cgi - does it work now?

All the best
Shaun

Quote Reply
Re: Username in Static home.html In reply to
i tried it this way. but dynamically it's still the same.

but i'm really looking for a way to use in static pages.

maybe a cgi or via ssi or somthing like that.

Quote Reply
Re: Username in Static home.html In reply to
This can only be done via Server Side Includes (SSI). It cannot be created as a global tag and then print within the static page.

Although as Alex has mentioned before, if you compare executing SSI driven CGI scripts versus running page.cgi, the CPU/Memory usage about the same in most cases.

And what you have probably neglected to do is turn on dynamic within your page.cgi script with the d=1 param.

Regards,

Eliot Lee
Quote Reply
Re: Username in Static home.html In reply to
Eliot is right, you need to switch to dynamic mode, and put all calls through page.cgi. Then you can do:

<%if Username%>
.. user is logged in
<%else%>
.. user is not logged in
<%endif%>

anywhere in your templates.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Username in Static home.html In reply to
thanks for all the hints but cgi driven webpages (page.cgi) are in fact very slow in comparison to static html websites.
and speed is money, because no user likes slow websites and waiting.

because of that i think about a ssi-solution using a very small cgi-script.

i know the dynamic-mode would be much easier.

Quote Reply
Re: Username in Static home.html In reply to
Well your in luck. I don't know why this hasn't been suggested by anyone yet - but I did a plugin for this some time ago.

Here is a link to the thread:
http://www.gossamer-threads.com/...&vc=1#Post125550

This version works via a quick SSI call. I was going to do a javascript version, which would have allowed it to work universally (in static and in dynamic mode), but it didn't seem like anyone wanted it or cared...

AlexJ

Quote Reply
Re: Username in Static home.html In reply to
hey, that sounds great !

does it work with linkssql 2.0.3 ?

do you have a javascript-version ?
that would be very much better for universally work as you mentioned and of course you don't have to turn everything to *.shtml - pages.

let me know if there is a java-script routine !

Thanks a lot, Manu

Quote Reply
Re: Username in Static home.html In reply to
I never did convert it to work as both SSI and javascript...

But since this is really what you need - I'll do it. Should be able to knock that out sometime today.

AlexJ

Quote Reply
Re: Username in Static home.html In reply to
It would be very cool to have this as a javascript to use in every page. I am interested in such a thing, please let me know if you make this addition!

Thanks

Quote Reply
Re: Username in Static home.html In reply to
javascript.. yes this would be really great !!!!!

Thanks a lot !


Quote Reply
Re: Username in Static home.html In reply to
SSI is more interoperatable between browsers (Server side rather than Client side) and also processes faster than javascript.

Just use SSI in my opinion...

Regards,

Eliot Lee
Quote Reply
Re: Username in Static home.html In reply to
Problem is that SSI has to be enabled on the server end, and it adds a large performance penalty to the serving of pages.

If all your pages are .shtml then you might as well use cgi and mod_perl, or even PHP.

Actually, PHP is probably an overall better choice than SSI.



PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: Username in Static home.html In reply to
Ok,

Great news... Its done. Here is a link to download the UserLookup 1.05 plugin. It works in either Javascript or SSI mode.

UserLoopup 1.05 http://www.netmall.net/UserLookup.tar

To include the current user via javascript in dynamic or static modes use this tag:

Code:
<script language='javascript' src='<%build_root_url%>/user-lookup.cgi?js=1'> </script>
To use via SSI, execute the script via SSI, without the js=1 parameter.

Please let me know how it works out for you...

Enjoy,

AlexJ

Quote Reply
Re: Username in Static home.html In reply to
Hey Alex, thank you very much. It works well.

But maybe you can help me once again.

I want to display the username as value of a login form.
But I don't know how.
I've tried the following, but i doesn't work :
<HTML>
<HEAD></HEAD>

<SCRIPT language="JavaScript">
function user()
{
nameuser.src="http://www.shop-netz.de/cgi-bin/shop/user-lookup.cgi?js=1";
window.document.User.Username.value=nameuser.src;
}
</SCRIPT>

<BODY ... onload="user()">
...

<FORM action="..." method="post" name="User">
Username : <INPUT NAME="Username">

<input type=submit value="Login">
</FORM>

...

</BODY>
</HTML>


Quote Reply
Re: Username in Static home.html In reply to
Ok,

I can try to help - but I will need to get a better grasp of what you are trying to do....

It looks like you are trying to use the username returned by my plugin to populate some form fields.

If you are trying to populate the fields to login to Links, this won't work, as my plugin returns 'Guest' until they are logged in.

If you are trying to fill in your Links username in a form to login to something else - there should be a way to do this. . . . We just need to figure out the correct JS coding.

I suppose in a worst case scenerio you could do a hack of my plugin and have it return your entire input tag populated as an option... I'd rather try to get this done properly though...

AlexJ