LassoStartup not executing?

classic Classic list List threaded Threaded
55 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Re: [server_name]

dguardiola

Le 11 avr. 08 à 18:44, Jim de Zwart a écrit :
> Be sure to take a close look at your Apache configuration file,  
> compare servername and serveralias settings.

Jim,
The Servername directive looks usefulwith a one-host server,
how can this cope with virtual hosts ?

from the conf file :
# ServerName allows you to set a host name which is sent back to  
clients for# your server if it's
#different than the one the program would get (i.e., use# "www"  
instead of the host's real name).

(i do not use the alias apache functions)
--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Checkerboard layout for records?

Marc Pinnell-3
In reply to this post by Ken Wallace-2
Go ahead and use the <td> syntax (unless you want to try CSS?). Then  
every 5th iteration, insert a </tr><tr> and away you go. Remember to  
close the last </tr>. If you can't get it drop me a note and I will  
try to dig out the code I used on a site.

Marc

On Apr 11, 2008, at 9:49 AM, Ken Wallace wrote:

>
>
> Hi all,
>
> From a database referencing photo thumbnails, we'd like a checkerboard
> 5 across and however many rows of photos down.
>
> Spilling [records] into <tr> goes down – into <td> goes across.
> How does one make the checkerboard?
>
> Thanks,
>
> Ken
> --
> Sealevel, Halifax, Nova Scotia
> www.sealevel.ca
> skype: sealevelns
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>

--
Marc Pinnell
1027 Design
PO Box 990872
Redding, CA 96099-0872
530.941.4706
www.1027Design.com




--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Checkerboard layout for records?

Marc Pope
In reply to this post by Ken Wallace-2
There's prob easier ways to do this but here's something that will get  
you there...

<?lassoscript

        var:'color_base'='#ffffff';
        var:'color_extra'=#666666';
        var:'color_current'=$color_base;
        var:'col_max'= 5;
        var:'cur_col'=1;
        var:'row_closed'=1;

        inline: -search, -database=$db, -table=$table, 'otherstuff' =  
$something;

        '<table>\r\n';
        '<tr>';
        records;
                '<td bgcolor="' $color_current '">
                        <img src="/pathtoimages/' (field:'filename') '" />
                </td>';

                if: $color_current == $color_base;
                        $color_current = $color_extra;
                else;
                    $color_current = $color_base;
                /if;

                if: $cur_col == 5;
                        $cur_col = 1;
                        $row_closed = 1;
                        '</tr>';
                else;
                        $cur_col = (math_add: $cur_col, 1);
                        $row_closed = 0;
                /if;

         records;
                if: !$row_closed;
                '</tr>';
                /if;
               
                '</table>';

        /inline;
               
?>

-marc

On Apr 11, 2008, at 12:49 PM, Ken Wallace wrote:

>
>
> Hi all,
>
> From a database referencing photo thumbnails, we'd like a checkerboard
> 5 across and however many rows of photos down.
>
> Spilling [records] into <tr> goes down – into <td> goes across.
> How does one make the checkerboard?
>
> Thanks,
>
> Ken
> --
> Sealevel, Halifax, Nova Scotia
> www.sealevel.ca
> skype: sealevelns
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Checkerboard layout for records?

dguardiola
In reply to this post by Marc Pinnell-3

Le 11 avr. 08 à 19:22, Marc Pinnell a écrit :
> Go ahead and use the <td> syntax (unless you want to try CSS?).  
> Then every 5th iteration, insert a </tr><tr> and away you go.  
> Remember to close the last </tr>. If you can't get it drop me a  
> note and I will try to dig out the code I used on a site.


this used to work for me:

[records]

<td>....</td>

[var(max_cols) = integer(5)]
[If: (Loop_Count % $max_cols) == '0']</tr><tr>[/If]

[/records]



--
Dominique Guardiola, QUINODE
http://www.quinode.fr/





--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Checkerboard layout for records?

Marc Pope
In reply to this post by Ken Wallace-2
Sorry there was a typo in that last one, and I added some beauty  
returns for the code:


<?lassoscript

        var:'color_base'='#ffffff';
        var:'color_extra'=#666666';
        var:'color_current'=$color_base;
        var:'col_max'= 5;
        var:'cur_col'=1;
        var:'row_closed'=1;

        inline: -search, -database=$db, -table=$table, 'otherstuff' =  
$something;

        '<table>
        <tr>
';
        records;
                '<td bgcolor="' $color_current '">
                \t<img src="/pathtoimages/' (field:'filename') '" />
                </td>
';
                if: $color_current == $color_base;
                        $color_current = $color_extra;
                else;
                    $color_current = $color_base;
                /if;

                if: $cur_col == 5;
                        $cur_col = 1;
                        $row_closed = 1;
                        '</tr>\r\n';
                else;
                        $cur_col = (math_add: $cur_col, 1);
                        $row_closed = 0;
                /if;

         /records;

                if: !$row_closed;
                '</tr>\r\n';
                /if;
               
                '</table>\r\n';

        /inline;
               
?>

-marc
On Apr 11, 2008, at 12:49 PM, Ken Wallace wrote:

>
>
> Hi all,
>
> From a database referencing photo thumbnails, we'd like a checkerboard
> 5 across and however many rows of photos down.
>
> Spilling [records] into <tr> goes down – into <td> goes across.
> How does one make the checkerboard?
>
> Thanks,
>
> Ken
> --
> Sealevel, Halifax, Nova Scotia
> www.sealevel.ca
> skype: sealevelns
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: [server_name]

Jim de Zwart
In reply to this post by dguardiola
You can use in in any vhost container.

For example I have something like this:

<VirtualHost *:80>
    Include conf/lasso8.conf
    DocumentRoot "c:/inetpub/lp8local"
    ServerName lp8.local
    ErrorLog logs/lp8_local_error.log
    CustomLog logs/lp8_local_access.log combined
</VirtualHost>

Dominique Guardiola wrote:

>
> Le 11 avr. 08 à 18:44, Jim de Zwart a écrit :
>> Be sure to take a close look at your Apache configuration file,
>> compare servername and serveralias settings.
>
> Jim,
> The Servername directive looks usefulwith a one-host server,
> how can this cope with virtual hosts ?
>
> from the conf file :
> # ServerName allows you to set a host name which is sent back to
> clients for# your server if it's
> #different than the one the program would get (i.e., use# "www"
> instead of the host's real name).
>
> (i do not use the alias apache functions)

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Checkerboard layout for records?

Jolle Carlestam-2
In reply to this post by Ken Wallace-2
11 apr 2008 kl. 18.49 skrev Ken Wallace:

>
>
>
> Hi all,
>
> From a database referencing photo thumbnails, we'd like a checkerboard
> 5 across and however many rows of photos down.
>
> Spilling [records] into <tr> goes down – into <td> goes across.
> How does one make the checkerboard?

I believe this is a fairly compact way of doing it:

<html>
<head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        <title>Checkerboard</title>
        <style type="text/css" title="text/css">
        .checker_1 {
                color: red;
                background: blue;
        }
        .checker_0 {
                color: blue;
                background: red;
        }
        </style>
</head>
<body>
<?LassoScript
        var('loops' = 20);
        '<table>
        <tr>';
        loop($loops);
                '<td class="checker_' + (loop_count % 2) + '">' + 'Here goes your  
field ref' + '<td>';
                (loop_count % 5) == 0 && loop_count != $loops ? '</tr><tr>';
        /loop;
        if($loops % 5 != 0);
                loop(5 - $loops % 5);
                        '<td>&#160;</td>'; // This is to get even number of table cells at  
the end
                /loop;
        /if;
        ' </tr>
</table>'
?>
</body>
</html>

Obviously you would replace first loop with a records container and  
set var loops to the found_count of your search. But there's no  
problem using loop_count within a records container.

HDB
Jolle
--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Checkerboard layout for records?

Jolle Carlestam-2
Minor typo. Important though...

11 apr 2008 kl. 22.37 skrev Jolle Carlestam:
> '<td class="checker_' + (loop_count % 2) + '">' + 'Here goes your  
> field ref' + '<td>';
                '<td class="checker_' + (loop_count % 2) + '">' + 'Here goes your  
field ref' + '</td>';

HDB
Jolle

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Checkerboard layout for records?

Jolle Carlestam-2
In reply to this post by Jolle Carlestam-2
11 apr 2008 kl. 22.37 skrev Jolle Carlestam:
> <td class="checker_' + (loop_count % 2) + '">

And this only works if it's an uneven number of table columns (3, 5, 7  
etc) since it basically sets every second column to the alternating  
css class. If the columns are even then there wont be a checkerboard  
effect.

HDB
Jolle

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: LassoStartup not executing?

Steve Upton
In reply to this post by Fletcher Sandbeck-3
At 9:42 PM -0700 4/10/08, Fletcher Sandbeck wrote:

>On 4/10/08 at 9:32 PM, [hidden email] (Steve Upton) wrote:
>
>>OK, now I need to figure out why it worked under 8.5.4 and not under
>>8.5.5... or if there's something else afoot.
>>
>>I have a background script launch (via -async) at startup. It executes
>>every 30 seconds or so. When it executes it calls (via the include
>>tag) a URL on our server. That page does all the stuff we need done
>>periodically. The URL contains the server_name tag so I can move it
>>around on our servers without having to modify it.
>>
>>It worked until I upgraded to 8.5.5 on Tuesday...
>>
>>one of those "no Idea how it worked, but I know why it doesn't now" kind of phenomena?
>
>Can you log [Server_Name] in that script?  That should let you know what value is being returned.  I don't think anything should have changed with that tag.  When you call a page through [Include_URL] it is seen as the same as calling a page through a normal Web browser.

that's what I'm doing (it's doing) now.

Each time it executes, it is supposed to put out the server name and it outputs nothing - not an IP address either as the dox suggest it is supposed to.

I am not calling it within the called web page itself, however. But rather, within the code that was launched at site start and and keeps executing periodically. I was using it to call the web page.

Steve


--


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: LassoStartup not executing?

Adam Randall-2
On Fri, 11 Apr 2008 15:46:00 -0700, Steve Upton wrote:

> At 9:42 PM -0700 4/10/08, Fletcher Sandbeck wrote:
>> On 4/10/08 at 9:32 PM, [hidden email] (Steve Upton) wrote:
>>
>>> OK, now I need to figure out why it worked under 8.5.4 and not under
>>> 8.5.5... or if there's something else afoot.
>>>
>>> I have a background script launch (via -async) at startup. It executes
>>> every 30 seconds or so. When it executes it calls (via the include
>>> tag) a URL on our server. That page does all the stuff we need done
>>> periodically. The URL contains the server_name tag so I can move it
>>> around on our servers without having to modify it.
>>>
>>> It worked until I upgraded to 8.5.5 on Tuesday...
>>>
>>> one of those "no Idea how it worked, but I know why it doesn't now"
>>> kind of phenomena?
>>
>> Can you log [Server_Name] in that script?  That should let you know
>> what value is being returned.  I don't think anything should have
>> changed with that tag.  When you call a page through [Include_URL]
>> it is seen as the same as calling a page through a normal Web
>> browser.
>
> that's what I'm doing (it's doing) now.
>
> Each time it executes, it is supposed to put out the server name and
> it outputs nothing - not an IP address either as the dox suggest it
> is supposed to.
>
> I am not calling it within the called web page itself, however. But
> rather, within the code that was launched at site start and and keeps
> executing periodically. I was using it to call the web page.
>
> Steve

There's no way for Lasso to know what the server name is when you launch something at startup asynchronously. All that information comes from Apache, including the IP address. Lasso's only attached to Apache when a request comes in, which Apache pushes to Lasso. Only at that time is there the state that provides the server_name and ip address.

It's been like this for a very long time. IP address and server_name will both return null in these cases.

Adam.

--
-----------------------------------------------------------------------
Adam Randall                                       http://www.xaren.net
[hidden email]                                   AIM/iChat:  blitz574

"Macintosh users are a special case. They care passionately about the
Mac OS and would rewire their own bodies to run on Mac OS X if such a
thing were possible." -- Peter H. Lewis

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: LassoStartup not executing?

Fletcher Sandbeck-3
In reply to this post by Steve Upton
On 4/11/08 at 3:46 PM, [hidden email] (Steve Upton) wrote:

>>Can you log [Server_Name] in that script?  That should let you know
>>what value is being returned.  I don't think anything should have
>>changed with that tag. When you call a page through [Include_URL] it
>>is seen as the same as calling a page through a normal Web browser.
>
>that's what I'm doing (it's doing) now.
>
>Each time it executes, it is supposed to put out the server name and
>it outputs nothing - not an IP address either as the dox suggest it is
>supposed to.
>
>I am not calling it within the called web page itself, however.
>But rather, within the code that was launched at site start and
>and keeps executing periodically. I was using it to call the
>web page.

What confuses me is why [Server_Name] was ever returning a value
under those circumstances.  I've tested here under 8.5.5, 8.1,
and 7.0.6 and [Server_Name] always returns an empty string when
called within LassoStartup.  An asynchronous process started in
LassoStartup should inherit the same empty value.

It seems like there must be some other change which has caused
the discrepancy.  Is it possible that you had a script like I
suggested which was actually redefining [Server_Name] that got
lost somehow?

[fletcher]

--
Fletcher Sandbeck                         [hidden email]
LassoSoft, LLC                          http://www.lassosoft.com


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: LassoStartup not executing?

dguardiola
In reply to this post by Adam Randall-2

Le 12 avr. 08 à 00:53, Adam Randall a écrit :
> There's no way for Lasso to know what the server name is when you  
> launch something at startup asynchronously. All that information  
> comes from Apache, including the IP address. Lasso's only attached  
> to Apache when a request comes in, which Apache pushes to Lasso.  
> Only at that time is there the state that provides the server_name  
> and ip address.
>
> It's been like this for a very long time. IP address and  
> server_name will both return null in these cases.

OK, so this is the final word on the story...
No way to use server_name within my ctags until someone hit a page  
(after a restart for example)

...So I have to create an event in Lasso that [include_URL] each site  
homepage a minute after restart to load everything. will that work if  
it's done by the same Lasso on the same server ?



--
Dominique Guardiola, QUINODE
http://www.quinode.fr/





--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: LassoStartup not executing?

Adam Randall-2
On Sat, 12 Apr 2008 10:56:37 +0200, Dominique Guardiola wrote:

>
> Le 12 avr. 08 à 00:53, Adam Randall a écrit :
>> There's no way for Lasso to know what the server name is when you
>> launch something at startup asynchronously. All that information
>> comes from Apache, including the IP address. Lasso's only attached
>> to Apache when a request comes in, which Apache pushes to Lasso.
>> Only at that time is there the state that provides the server_name
>> and ip address.
>>
>> It's been like this for a very long time. IP address and server_name
>> will both return null in these cases.
>
> OK, so this is the final word on the story...
> No way to use server_name within my ctags until someone hit a page
> (after a restart for example)
>
> ...So I have to create an event in Lasso that [include_URL] each site
> homepage a minute after restart to load everything. will that work if
> it's done by the same Lasso on the same server ?

My apologies for coming into this late, but I'm not exactly following. What are you trying to do? Maybe it's possible to change your logic around to get what you want while overriding this limitation.

Adam.

--
-----------------------------------------------------------------------
Adam Randall                                       http://www.xaren.net
[hidden email]                                   AIM/iChat:  blitz574

"Macintosh users are a special case. They care passionately about the
Mac OS and would rewire their own bodies to run on Mac OS X if such a
thing were possible." -- Peter H. Lewis

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

how to get the full host name

dguardiola
>
> My apologies for coming into this late, but I'm not exactly  
> following. What are you trying to do? Maybe it's possible to change  
> your logic around to get what you want while overriding this  
> limitation.

I needed to get the full host name of the server, and bumped into the  
fact that I use a tweaked hosts file on my dev server, so  
[server_name] behaves differently in this case, returning  
"dev.example.com" instead of just the domain name as usual.
So all ctags using server_name to re-construct the full host name  
were failing

Quick and dirty solution :

<?lassoscript
        define_tag('host', -namespace='cms_', -priority='replace');
  if:  array('127.0.0.1','192.168.2.2') >> client_ip;
                return: server_name;
                //this will give me 'dev.example.com'
        else;
                return: 'www.' + server_name;
                //and this will output 'www.example.com'
        /if;
/define_tag;
?>

the two IP are thedev machine and my test PC, so this case apply for  
pages served on the dev server
for the real server, it will append 'www' as this is a common setup  
for all my sites now

This is a bad solution:
- what if the visitor use the short domain name : http://domain.com,  
without the 'www', now I need a redirection in order to add the 'www'  
to any visitor not using them
- what if I need to setup up differents sub-hosts

perhaps a 'dev.example.com' record in the hosts file is a bad  
solution, but i need to know, within any lassoscript if I'm  
outputting for testing or if it's "for real" (in order to send email  
alerts to the site owner or just locally, for example)

Last one, the methods using headers parsing (two ctags on tagswap,  
one from bil and from johan) to return the requested hosts seems to  
result in crashes under some IE configurations . I cannot guarantee  
that 100% but I had several problems with some clients with old PC  
setups, like redirections based on this method never working, lasso  
process looping and hitting 100% CPU...


Any insight on the subject is welcome!!!!


--
Dominique Guardiola, QUINODE
http://www.quinode.fr/




--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: LassoStartup not executing?

Steve Upton
In reply to this post by Adam Randall-2
At 11:17 AM -0700 4/12/08, Adam Randall wrote:

>On Sat, 12 Apr 2008 10:56:37 +0200, Dominique Guardiola wrote:
>>
>> Le 12 avr. 08 à 00:53, Adam Randall a écrit :
>>> There's no way for Lasso to know what the server name is when you
>>> launch something at startup asynchronously. All that information
>>> comes from Apache, including the IP address. Lasso's only attached
>>> to Apache when a request comes in, which Apache pushes to Lasso.
>>> Only at that time is there the state that provides the server_name
>>> and ip address.
>>>
>>> It's been like this for a very long time. IP address and server_name
>>> will both return null in these cases.
>>
>> OK, so this is the final word on the story...
>> No way to use server_name within my ctags until someone hit a page
>> (after a restart for example)
>>
>> ...So I have to create an event in Lasso that [include_URL] each site
>> homepage a minute after restart to load everything. will that work if
>> it's done by the same Lasso on the same server ?
>
>My apologies for coming into this late, but I'm not exactly following. What are you trying to do? Maybe it's possible to change your logic around to get what you want while overriding this limitation.

I'm not sure about Dominique but in my case I am starting up a periodically-invoked loop. It fires regulary and pulls pages from our site. Those pages contain the needed tasks. This allows me to have everything setup and running before the web pages get called. Also, I can make changes to the called pages & I don't need to restart the site each time.

I may now know more about the problem I was having and how it may have worked previously.

My lasso call went like this:

include_url('http://'+server_name+'/pagepath');

I think something in my previous config allowed this call to work with a blank server_name and now it doesn't work.

This bring me back to a previous problem. I exported the original site & then imported after my Lasso reinstall. It seems to have lost the settings for Host: and Root:. I can't remember what they were and the site works ok now with them blank... perhaps with a blank root, the above relative URL now doesn't resolve correctly?

thanks all,

Steve


--


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: how to get the full host name

Jolle Carlestam-2
In reply to this post by dguardiola
12 apr 2008 kl. 20.52 skrev Dominique Guardiola:

>
>>
>> My apologies for coming into this late, but I'm not exactly  
>> following. What are you trying to do? Maybe it's possible to change  
>> your logic around to get what you want while overriding this  
>> limitation.
>
> I needed to get the full host name of the server, and bumped into  
> the fact that I use a tweaked hosts file on my dev server, so  
> [server_name] behaves differently in this case, returning  
> "dev.example.com" instead of just the domain name as usual.
> So all ctags using server_name to re-construct the full host name  
> were failing
>
> Quick and dirty solution :
>
> <?lassoscript
> define_tag('host', -namespace='cms_', -priority='replace');
> if:  array('127.0.0.1','192.168.2.2') >> client_ip;
> return: server_name;
> //this will give me 'dev.example.com'
> else;
> return: 'www.' + server_name;
> //and this will output 'www.example.com'
> /if;
> /define_tag;
> ?>
>
> the two IP are thedev machine and my test PC, so this case apply for  
> pages served on the dev server
> for the real server, it will append 'www' as this is a common setup  
> for all my sites now
>
> This is a bad solution:
> - what if the visitor use the short domain name : http://domain.com,  
> without the 'www', now I need a redirection in order to add the  
> 'www' to any visitor not using them
> - what if I need to setup up differents sub-hosts
>
> perhaps a 'dev.example.com' record in the hosts file is a bad  
> solution, but i need to know, within any lassoscript if I'm  
> outputting for testing or if it's "for real" (in order to send email  
> alerts to the site owner or just locally, for example)
>
> Last one, the methods using headers parsing (two ctags on tagswap,  
> one from bil and from johan) to return the requested hosts seems to  
> result in crashes under some IE configurations . I cannot guarantee  
> that 100% but I had several problems with some clients with old PC  
> setups, like redirections based on this method never working, lasso  
> process looping and hitting 100% CPU...
>
>
> Any insight on the subject is welcome!!!!

I've not followed this thread with that much attention since I from  
the start failed to see why it mattered. And I still fail to see why  
it's so important to dynamically find out the server name. If I needed  
a precise reference like that and be sure that it's not something else  
I would simply put the info into a var that's on a page that always  
get read.

Every site I have is defined in a virtual host section in Apache  
config. And every site is mapped to a unique place on the server.

So for every site served there's a unique config document residing  
within each specific sites directory. In that config doc there's a var  
holding that sites name. Can't you just do it this way instead of  
trying to find out on the fly what you called the site in apache  
config? Oh, yes, you have to put the name of the site in two places  
instead of one. In the Apache config file and the Lasso site config  
file. It's not as hard as it maybe sounds like... :-)

HDB
Jolle

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: how to get the full host name

Trevor Borgmeier
Here is what I use:

    define_tag('host_name');
   
        protect;
            handle_error;
                return(server_name);
            /handle_error;
           
           
return(string_findregexp(client_headers,-find='(?:\\s|^)host:\\s+([^\\s]+)',-ignorecase)->get(2));
           
        /protect;
       
    /define_tag;

If you build a site that does branding for other clients ... lets say
you've got a sight that has something to do with bubble gum and al
bubble gum makers want their own branded partof your site for whatever
reason and they want subdomains rather than strange id's or a spot in
the path...

then you have

hubbabubba.domain.com
bubblicious.domain.com
bigleaguechew.domain.com

Now it wouldn't make much sense to try and maintain the same site
duplicated in multiple locations... you could even get by with one
virtual host record so you don't have to add a new VH each time a new
subdomain is needed.

Of course, most sites will be managed as Jolle describe, but the
scenario I described above is made a lot easier when one can get the
host name...

-Trevor



Jolle Carlestam wrote:

> 12 apr 2008 kl. 20.52 skrev Dominique Guardiola:
>>
>>>
>>> My apologies for coming into this late, but I'm not exactly
>>> following. What are you trying to do? Maybe it's possible to change
>>> your logic around to get what you want while overriding this
>>> limitation.
>>
>> I needed to get the full host name of the server, and bumped into the
>> fact that I use a tweaked hosts file on my dev server, so
>> [server_name] behaves differently in this case, returning
>> "dev.example.com" instead of just the domain name as usual.
>> So all ctags using server_name to re-construct the full host name
>> were failing
>>
>> Quick and dirty solution :
>>
>> <?lassoscript
>>     define_tag('host', -namespace='cms_', -priority='replace');
>>     if:  array('127.0.0.1','192.168.2.2') >> client_ip;
>>         return: server_name;
>>         //this will give me 'dev.example.com'
>>     else;  
>>         return: 'www.' + server_name;
>>         //and this will output 'www.example.com'      
>>     /if;
>> /define_tag;
>> ?>
>>
>> the two IP are thedev machine and my test PC, so this case apply for
>> pages served on the dev server
>> for the real server, it will append 'www' as this is a common setup
>> for all my sites now
>>
>> This is a bad solution:
>> - what if the visitor use the short domain name : http://domain.com,
>> without the 'www', now I need a redirection in order to add the 'www'
>> to any visitor not using them
>> - what if I need to setup up differents sub-hosts
>>
>> perhaps a 'dev.example.com' record in the hosts file is a bad
>> solution, but i need to know, within any lassoscript if I'm
>> outputting for testing or if it's "for real" (in order to send email
>> alerts to the site owner or just locally, for example)
>>
>> Last one, the methods using headers parsing (two ctags on tagswap,
>> one from bil and from johan) to return the requested hosts seems to
>> result in crashes under some IE configurations . I cannot guarantee
>> that 100% but I had several problems with some clients with old PC
>> setups, like redirections based on this method never working, lasso
>> process looping and hitting 100% CPU...
>>
>>
>> Any insight on the subject is welcome!!!!
>
> I've not followed this thread with that much attention since I from
> the start failed to see why it mattered. And I still fail to see why
> it's so important to dynamically find out the server name. If I needed
> a precise reference like that and be sure that it's not something else
> I would simply put the info into a var that's on a page that always
> get read.
>
> Every site I have is defined in a virtual host section in Apache
> config. And every site is mapped to a unique place on the server.
>
> So for every site served there's a unique config document residing
> within each specific sites directory. In that config doc there's a var
> holding that sites name. Can't you just do it this way instead of
> trying to find out on the fly what you called the site in apache
> config? Oh, yes, you have to put the name of the site in two places
> instead of one. In the Apache config file and the Lasso site config
> file. It's not as hard as it maybe sounds like... :-)
>
> HDB
> Jolle
>

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: how to get the full host name

Jolle Carlestam-2
13 apr 2008 kl. 00.37 skrev Trevor Borgmeier:

> If you build a site that does branding for other clients ... lets  
> say you've got a sight that has something to do with bubble gum and  
> al bubble gum makers want their own branded partof your site for  
> whatever reason and they want subdomains rather than strange id's or  
> a spot in the path...
>
> then you have
>
> hubbabubba.domain.com
> bubblicious.domain.com
> bigleaguechew.domain.com
>
> Now it wouldn't make much sense to try and maintain the same site  
> duplicated in multiple locations... you could even get by with one  
> virtual host record so you don't have to add a new VH each time a  
> new subdomain is needed.
>
> Of course, most sites will be managed as Jolle describe, but the  
> scenario I described above is made a lot easier when one can get the  
> host name...

I stand corrected. I see now that there can be situations where you  
would want to set the value dynamically.

But I still fail to see the problem, admitting that I've not followed  
the thread closely.
I did a quick test on a site I have using several ServerAliases in the  
virtual host config.
server_name returned the host name used on the call each time. If I  
tried one of the aliases I got that returned. So the scenario Trevor  
outlines wouldn't be a problem. Using server_name I can set a var in  
my site config doc storing the host name used by the visitor and  
proceed with that.

HDB
Jolle

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: how to get the full host name

Wade Maxfield
Jolle Carlestam wrote:

>
> I stand corrected. I see now that there can be situations where you
> would want to set the value dynamically.
>
> But I still fail to see the problem, admitting that I've not followed
> the thread closely.
> I did a quick test on a site I have using several ServerAliases in the
> virtual host config.
> server_name returned the host name used on the call each time. If I
> tried one of the aliases I got that returned. So the scenario Trevor
> outlines wouldn't be a problem. Using server_name I can set a var in my
> site config doc storing the host name used by the visitor and proceed
> with that.
>
> HDB
> Jolle
>

What you saw isn't what you always get.  8)

The UseCanonicalName directive - httpd.conf - has influence here.  If
this is set to On then the ServerName (as defined in the virtual host)
is returned no matter what name the client used to get to the site

Say we have

<VirtualHost *>
     ServerName domain.com
     ServerAlias www.domain.com
</VirtualHost>

So if UseCanonicalName is off, then when a client hits the site using
domain.com, Apache passes the server name to Lasso as domain.com and if
they hit www.domain.com Lasso sees www.domain.com

And if UseCanoncalName is on, then no matter which name the client hits
the site with, the server name passed to lasso will always be domain.com

I set it to On, on my setup so that I can have a site answer to multiple
domain names, without having to add each name to the Lasso Sites setup.

  - Wade

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

123