Advertisement:

Author Topic: XHTML error  (Read 3744 times)

Offline gog

  • Jr. Member
  • **
  • Posts: 104
  • avatar :)
    • webote.com
XHTML error
« on: July 29, 2006, 05:24:57 AM »
There is one small error, since SMF defaults to XHTML output there is a little problem with Board (category) names. On the board index, you have:

<a name="2" href="http://www.simplemachines.org/community/index.php?action=collapse;c=2;sa=expand#2">Simple Machines</a>

In XHTML you have to use id's for anchors, not "name" attributes. For compatibility reasons it would be advisable to use both id and name. The problem is that the value of "name" is an integer, and id's can't start with an integer.

The simplest way to resolve this problem is to add "id" and prefix it with, for example "a". To do this edit Sources/BoardIndex.php search for line:

Code: [Select]
$context['categories'][$row_board['ID_CAT']]['link'] = '<a name="' . $row_board['ID_CAT'] . '" href="' . (isset($row_board['canCollapse']) ? $context['categories'][$row_board['ID_CAT']]['collapse_href'] : $context['categories'][$row_board['ID_CAT']]['href']) . '">' . $row_board['catName'] . '</a>';
and replace it with:

Code: [Select]
$context['categories'][$row_board['ID_CAT']]['link'] = '<a name="a' . $row_board['ID_CAT'] . '" id="a' . $row_board['ID_CAT'] . '" href="' . (isset($row_board['canCollapse']) ? $context['categories'][$row_board['ID_CAT']]['collapse_href'] : $context['categories'][$row_board['ID_CAT']]['href']) . '">' . $row_board['catName'] . '</a>';
Can you tell me if you are going to include this "fix" in the next release? I wouldn't like to change it myself and having to change it again later when new version arrives, I don't like to change my URI's to often :)

Offline gog

  • Jr. Member
  • **
  • Posts: 104
  • avatar :)
    • webote.com
Re: XHTML error
« Reply #1 on: July 30, 2006, 09:42:42 AM »
Can I hear something from the developers please!   ;)

Offline gog

  • Jr. Member
  • **
  • Posts: 104
  • avatar :)
    • webote.com
Re: XHTML error
« Reply #2 on: August 04, 2006, 11:09:41 AM »
OK, I guess that's a no :) Nevermind, I've made some changes as stated in the first post, and there were some other issues as well.

In Javascript one should escape "</" that is used in HTML often. for example document.write("</P>"); should really be document.write("<\/P>");.

If you are a freak like me :) you can do the following. In your themes folder (if you don't find this files in your theme folder look into the default one and copy it):

Disclaimer: I run a CVS version, your mileage may vary...

edit Display.template.php
- line 554 fix </div>, </textarea>, </div> into <\/div>, <\/textarea>, <\/div>, the line starts with
Code: [Select]
var smf_template_body_edit = \'<div
-line 561:
Code: [Select]
var smf_template_subject_normal = \'<a href="', $scripturl, '?topic=', $context['current_topic'], '.msg668875#msg668875">%subject%</a>\';should be:
Code: [Select]
var smf_template_subject_normal = \'<a href="', $scripturl, '?topic=', $context['current_topic'], '.msg668875#msg668875">%subject%<\/a>\';
Edit MessageIndex.template.php
- line 431 from:

Code: [Select]
setInnerHTML(cur_subject_div, \'<a href="', $scripturl, '?topic=\' + cur_topic_id + \'.0">\' + subject + \'</a>\');
to

Code: [Select]
setInnerHTML(cur_subject_div, \'<a href="', $scripturl, '?topic=\' + cur_topic_id + \'.0">\' + subject + \'<\/a>\');
That's I believe all folks. Install HTML validator extension and feel free to browse my forum at www.webote.com/forum/ (croatian only :) )