https vs. http in nav

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

https vs. http in nav

stevepiercy
I've got a site that is mostly served over http, but they want
to accept donations securely and will need a couple of files
over https.  Is there anything built into Knop to handle the
automatic generation of links like this:

server_port == 80
-------------------------
<a href="/home/">Home</a>
<a href="/about_us/">About Us</a>
<a href="https://www.charity.org/donate/">Donate</a>

server_port == 443
-------------------------
<a href="http://www.charity.org/home/">Home</a>
<a href="http://www.charity.org/about_us/">About Us</a>
<a href="/donate/">Donate</a>

I made a wild and incorrect guess with:

     $nav->insert(-url='https://www.charity.org/donate/');

I looked at a way to dynamically prefix links appropriately with
regular expressions on [string(#nav->renderhtml(-expand))], but
my head exploded.

Anyone got any ideas of how to solve this?

--steve

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --
Steve Piercy               Web Site Builder              
Soquel, CA
<[hidden email]>                  <http://www.StevePiercy.com/>


--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/
Reply | Threaded
Open this post in threaded view
|

Re: https vs. http in nav

stevepiercy
On 1/16/11 at 6:04 AM, [hidden email] (Steve Piercy - Web Site Builder) pronounced:

> I've got a site that is mostly served over http, but they want to accept donations
> securely and will need a couple of files over https.  Is there anything built into
> Knop to handle the automatic generation of links like this:
>
> server_port == 80
> -------------------------
> <a href="/home/">Home</a>
> <a href="/about_us/">About Us</a>
> <a href="https://www.charity.org/donate/">Donate</a>
>
> server_port == 443
> -------------------------
> <a href="http://www.charity.org/home/">Home</a>
> <a href="http://www.charity.org/about_us/">About Us</a>
> <a href="/donate/">Donate</a>
>
> I made a wild and incorrect guess with:
>
>     $nav->insert(-url='https://www.charity.org/donate/');
>
> I looked at a way to dynamically prefix links appropriately with regular expressions
> on [string(#nav->renderhtml(-expand))], but my head exploded.
>
> Anyone got any ideas of how to solve this?

Pilsonism.

server_port != 443
-------------------------
string_replaceregexp(
    string($nav->renderhtml(-expand)),
    -find='href="/donate/',
    -replace='href="https://www.charity.org/donate/',
    -encodenone
);

server_port == 443
-------------------------
string_replaceregexp(
    string_replaceregexp(
        string($nav->renderhtml(-expand)),
        -find='href="/',
        -replace='href="http://www.charity.org/',
        -encodenone
    ),
    -find='href="http://www.charity.org/donate/',
    -replace='href="/donate/',
    -encodenone
);

--steve

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy               Web Site Builder               Soquel, CA
<[hidden email]>                  <http://www.StevePiercy.com/>


--
#############################################################
This message is sent to you because you are subscribed to
the mailing list <[hidden email]>.
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
List archive http://lasso.2283332.n4.nabble.com/Knop-Framework-Discussion-f3157831.html
Project homepage http://montania.se/projects/knop/
Google Code has the latest downloads at http://code.google.com/p/knop/