Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
574 views
in Q2A Core by
How to add a letter before the Div ID?
related to an answer for: How to fix css errors?

1 Answer

+1 vote
by
Yes, it's possible. Look for this line inside qa_post_html_fields in qa-app-format.php:

$fields['tags']=' ID="'.qa_html($postid).'" ';

And change it to:

$fields['tags']=' ID="x'.qa_html($postid).'" ';

In the example above, we add an 'x', but you can change this to whatever you want.

Now you need to include this same letter every time Q2A builds a link which includes a post ID after a #. For example this line in qa-page-question.php:

$request.='#'.$question['parentid'];

And this line in qa-app-format.php:

$fields['url'].='#'.qa_html(urlencode($acpostid));

In both cases, add the character (e.g. x) after the # symbol.

Also look for usage of qa_path() and qa_path_html() where the 5th parameter is specified. This is also an anchor. In this case, again, add the character before the parameter, if it's a post ID of some kind.
by
this will be erased at the next upgrade, isn't it? It would be better that this fix be applied in the author's source code. Thank you.
by
I don't feel it's an important issue to fix - it's a formal validation error, but a numerical ID works fine in all browsers, and makes sense architecturally. Anyone else care to share their view?
by
A few more people mentioned this, so I changed my mind - it will be fixed in the upcoming version.
by
edited by
That's a good idea I think. I'm not a massive fan of adhering rigidly to the spec, but the problem I find is that if you have lots of minor errors, the major ones are harder to spot. Also, you can never be sure that all browsers will interpret the ID thing in the same way.

Are you going to make the HTML lowercase as well? ;)
by
I know you're (mostly) joking... but just to explain, I think it's easier to read over the HTML source if attribute names are a different case from their values. A similar principle is applied in the SQL.
...