Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Validation of SS file

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 5629 Views
  • Mayuri
    Avatar
    Community Member
    19 Posts

    Validation of SS file Link to this post

    Hi all,

    I am a student and for quality assurance part of my project i need to have code validation.
    Could any one suggest me how can i can get validate my ss files?

    I tried with W3C validator but it gives error when ss code comes e.g. <% base_tag %>
    Is it possible for any one to check & validate my code & suggest me if i am making some mistakes?

  • ian
    Avatar
    Community Member
    7 Posts

    Re: Validation of SS file Link to this post

    Wh yare you trying to validate the template code before it is parsed?

    Shouldn't you be validating the html/css that is being sent to the broswer... ie the html source of http://www.your-silverstripe-site.com/home

  • Mayuri
    Avatar
    Community Member
    19 Posts

    Re: Validation of SS file Link to this post

    Hi Ian

    I had tried with source code also but it gives errors like;

    # Line 6, Column 49: end tag for "base" omitted, but OMITTAG NO was specified.

        <base href="http://localhost/site_mimomax/" >

    You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
    # Info Line 6, Column 4: start tag was here.

        <base href="http://localhost/site_mimomax/" >

    Is it b'cuz i have not hosted my site & it's not localhost?
    Does localhost creates errors?

  • ian
    Avatar
    Community Member
    7 Posts

    Re: Validation of SS file Link to this post

    This has nothing to do with localhost. The error message is telling you that the 'base' element is not closed.

    With xhtml, all tags (eg <div>) need to be closed (eg </div>). You can have self closing tags, which look like this <img src="something.jpg" />.

    The base tag should be self closing... ie <base href="http://localhost/site_mimomax/" />

    Note the slash at the end of the tag (in blue).

    FYI, my SS instance (2.2.2) is producing valid XHTML (my doctype is 1.0 Transitional)

  • Mayuri
    Avatar
    Community Member
    19 Posts

    Re: Validation of SS file Link to this post

    Hi Ian

    Thanks a lot for your co-operation. I still have some doubts. In my view source it comes like;
    <!---->
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en" >
       <head>

    While in my C:\wamp\www\site_mimomax\tutorial\templates\Page.ss file it's like;

    <!--<?xml version="1.0" encoding="UTF-8"?>-->
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" >

    How it changes to HTML while it's XHTML in page.ss file?

    Right now i have <!---xml ---> statment in only one page.ss file do i need to declare it in page.ss of layout folder also and same in all the .ss file of my layout folder?

    Can you guide me further more?

    How can i close <% base_tag %> tag? In tutorial 1 I didn't find any clue how to close it. I tried with <% base_tag % /> & < / % base_tag %> but it comes as text on html page.

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: Validation of SS file Link to this post

    I believe you can manually assign the href to the base tag, such as:

    <base href="$BaseHref"></base>

    instead of ... <% base_tag %>

    Cheers,
    Sean

    5629 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.