[Zope-CMF] Re: CMF base tag rant
Michael Haubenwallner
michael at d2m.at
Wed Mar 3 06:34:18 EST 2004
Alexander Limi wrote:
> OK, guys - minor rant upcoming. Sometimes pain needs to be shared, OK? :]
>
> Yesterday I tried to implement something known as a "skip" link for
> accessibility reasons. The rationale behind this is that at the top of
> every page, there should be a "skip to content" link for blind people
> and systems like mobile phones etc, so they don't have to read all the
> navigation and logo stuff before they get to the content.
>
> The process is really simple:
>
> - Add an <a name="someContent" /> tag right before the content
>
> - Make sure there is a link at the top of your page pointing to
> currentpage.html#someContent.
>
> Easy, right? Wrong.
>
> I load the front page of my CMF/Plone site. Base tag looks like this
> when rendered:
>
> <base href="http://localhost:8080/Plone/index_html" />
>
> Only problem is, my *real* URL is http://localhost:8080/Plone - without
> the index_html in there. Thus, I'm in for a world of pain.
>
quoting from
[cvs] / plone / CMFPlone / skins / plone_scripts / renderBase.py
(Revision 1.4)
---------------
# returns correct base href
if getattr(context.aq_explicit, 'isPrincipiaFolderish', 0):
return context.absolute_url()+'/'
else:
return context.absolute_url()
---------------
this could only happen if your object at "/Plone" is not PrincipiaFolderish.
i checked your case with zope and cmf and respective folder types
(using the renderBase script from plone-cvs).
reported base always was correct:
1) Zope
http://localhost:8080/test/index_html
<base href="http://localhost:8080/test/" />
http://localhost:8080/test/
<base href="http://localhost:8080/test/" />
2) CMF
http://localhost:8080/cmf/test
<base href="http://localhost:8080/cmf/test/" />
http://localhost:8080/cmf/test/index_html
<base href="http://localhost:8080/cmf/test/" />
so it looks like you are using another renderBase.py or you redirect to
index_html in some way...
> If I make a tag with a link href="#someContent", the page will reload,
> since it thinks that index_html#someContent is what I'm linking to.
>
> Some tinkering later, I try to do the following:
>
> tal:attributes="href string:${request/URL0}#someContent"
>
> But guess what? This won't work either.
>
> I investigate the options i have, noting that no variable seems to keep
> the actual URL that is *inside the fecking URL bar* in my browser.
>
> I turn to Simon Eisenmann for help, he comes up with an idea of using a
> combination of SERVER_URL and PATH_TRANSLATED to construct the actual
> URL we're at.
>
> But guess what? This doesn't work in Virtual Hosting scenarioes. So we
> have to create an additional rule that gets rendered if you have a
> Virtual Hosted system.
>
> The rule ends up looking like this:
>
> <a
> tal:define="url
> request/VIRTUAL_URL|string:${request/SERVER_URL}${request/PATH_TRANSLATED}"
> tal:attributes="href string:${url}#someContent"
>
>> Skip to content</a>
>
>
> Easy, right?
>
> When it could have been (and is, in the rest of the world) as simple as
> this:
>
> <a href="#someContent">Skip to content</a>
>
> And people wonder if it's "hard to keep compatibility with the CMF". Heh.
>
> Is this stuff scheduled for a cleanup in 1.5? Setting (and don't let me
> go into *depending*) on the base tag being set to something that is not
> the current URL is *evil*.
>
IMHO, bashing CMF is no way to go.
--
michael
More information about the Zope-CMF
mailing list