-- Matthew Ishii <[EMAIL PROTECTED]> wrote
(on Tuesday, 30 September 2008, 09:16 PM -0700):
> Thank you for the suggestions, and as everyone pointed out, the
> HTTP_REFERER is the issue here not the .phtml format.
>
> @Matthew - I was validating the markup .. the HTML that is rendered
> when you view it in a webbrowser. The W3C consortium is attempting to
> implement webstandards and practices in how developers create and
> display web pages. There are similar standards for CSS as well. I
> was simply trying to validate my HTML to these specific standards.
I'm well aware of the W3C and its validators - I was simply wanting to
know if you were trying to validate the original view script markup or
the rendered markup, as it makes a difference. :P
I've known people to attempt to validate their view scripts in the
past; if you use short tags, validation will fail, but normal tags work
fine. Since you were using short tags, there was a possibility that the
validation error was from an attempt to validate the view script markup,
and not the final, rendered result.
> On Tue, Sep 30, 2008 at 8:02 PM, Matthew Weier O'Phinney
> <[EMAIL PROTECTED]> wrote:
> > -- Matthew Ishii <[EMAIL PROTECTED]> wrote
> > (on Tuesday, 30 September 2008, 07:13 PM -0700):
> >> I am not sure if this has been brought up before (though most likely
> >> it has) however I will anyway, I am having issues validating my pages
> >> against the W3C webstandards for proper HTML markup. I am using the
> >> XHTML1_STRICT Doctype.
> >>
> >> It seems like the phtml webpage format is having difficulties working
> >> with the standards, for example, I have a 'back' link that is using
> >> the SERVER 'HTTP_REFERER' variable to direct users to the last visited
> >> page. When I attempt to validate the page with the following markup,
> >> I receive the following errors:
> >>
> >> Markup -
> >>
> >> <p class="padded_paragraph"><a href="<?php echo
> >> $_SERVER['HTTP_REFERER'] ?>" class="bold">Back</a></p>
> >>
> >> Error(s) -
> >>
> >> Line 92, Column 37: character "<" is the first character of a
> >> delimiter but occurred as data.
> >>
> >> Warning Line 93, Column 9: character "<" is the first character of a
> >> delimiter but occurred as data.
> >>
> >> <b>Notice</b>: Undefined index: HTTP_REFERER in
> >> <b>/home1/ioforgec/zend/applic
> >>
> >> What I find strange is the notice, that the validation service catches
> >> in the source, but when viewed by me in the browser and when viewed in
> >> the post-rendered source I dont see such a notice. I suppose the
> >> HTTP_REFERER is not set for a robotic user, which is what the
> >> validation service must be manifesting as to my application. But how
> >> can I prevent this from causing the page not to validate?
> >
> > A couple things I see here. First, what are you validating? the .phtml
> > file itself, or a page that renders that view script? Second, yes,
> > HTTP_REFERER is something that may or may not be present based on the
> > current request environment
> >
> > I'd suggest creating a view helper that generates the backlink; you
> > could then add some logic in the helper to check for the existence of
> > the key, and if not present, simply emit an empty string or an anchor.
> > It might look like this:
> >
> > class My_View_Helper_BackLink extends Zend_View_Helper_Abstract
> > {
> > public function backLink()
> > {
> > $link = '#';
> > if (array_key_exists('HTTP_REFERER', $_SERVER)) {
> > $link = $_SERVER['HTTP_REFERER'];
> > }
> > return '<a href="' . $link . '" class="bold">Back</a>';
> > }
> > }
> >
> > --
> > Matthew Weier O'Phinney
> > Software Architect | [EMAIL PROTECTED]
> > Zend Framework | http://framework.zend.com/
> >
>
--
Matthew Weier O'Phinney
Software Architect | [EMAIL PROTECTED]
Zend Framework | http://framework.zend.com/