Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

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

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

Validation of SS file


Reply


6 Posts   5728 Views

Avatar
Mayuri

Community Member, 19 Posts

3 June 2008 at 1:02pm

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?

Avatar
ian

Community Member, 7 Posts

3 June 2008 at 1:32pm

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

Avatar
Mayuri

Community Member, 19 Posts

3 June 2008 at 4:23pm

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?

Avatar
ian

Community Member, 7 Posts

3 June 2008 at 4:57pm

Edited: 03/06/2008 4:59pm

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)

Avatar
Mayuri

Community Member, 19 Posts

4 June 2008 at 10:17am

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" xml: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.

Avatar
Sean

Forum Moderator, 922 Posts

15 July 2008 at 6:27pm

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

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

instead of ... <% base_tag %>

Cheers,
Sean