> Olaf Radicke <[email protected]> hat am 4. Oktober 2013 um 19:20
> geschrieben:
>
>
>
> Hi Tommi!
>
> > Tommi Mäkitalo <[email protected]> hat am 4. Oktober 2013 um 18:39
> > geschrieben:
> > Why not just use constants?
> >
> > In a include:
> >
> >     namespace url
> >     {
> >          static const char SwitchToHandheldVersion[] =
> >     "/SwitchToHandheldVersion";
> >          static const char RSSfeedView[] = "/rss.xml";
> >          ...
> >     }
> >
> > Then in the ecpp:
> >
> > |     <a href="<$ url::SwitchToHandheldVersion $>">|
> >
> > If you want to change the url, just change it in the header and
> > recompile. It is much less overhead and not need for a lookup table.
>
> Yes, that is a very good idea. That is the better way. Thanks for
> you feedback.

But now, I see it is the old problem:

<a href="<$ url::RSSfeedView $>">

is effective:

<a href="/rss.xml">

And this is not a absolute URL. was we need is:

<a href="http[s]://[mydomain]:[80]/rss.xml">

If I us <a href="<$ url::RSSfeedView $>"> in a Page with url
/example_dir/example_site.html than switch with this link to
/example_dir/rss.xml but if I stand
/example_dir/example_subdir/example_site.html
than I switch to /example_dir/example_subdir/rss.xml

If I set the domain, protocol ant port fix in the include or in the ecpp
than I get same problem as before.  Hmm....

We can do this...

    namespace url
    {
        static const char protocol[] = "http";
        static const char domain[] = "mydomain.de";
        static const char port[] = "80";
        static const char RSSfeedView[] = "/rss.xml";
        ...
    }


    <a href="<$ url::protocol $>://<$ url::domain $>:<$ url::domain $><$
url::RSSfeedView $>">

Or a little bit better...


    namespace url
    {
        static const char urlPrefix[] = "http://mydomain.de:80";;
        static const char RSSfeedView[] = "/rss.xml";
        ...
    }


    <a href="<$ url::urlPrefix $><$ url::RSSfeedView $>">

But domain, protocol ant port is not hard coded. Is is normally in the config.

Gratings,

Olaf

-------------------|-------------------|-------------------|-------------------|

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to