Idea sandbox Idea sandbox
Popular ideas Popular ideas
Ideas in development Ideas in development
Implemented ideas Implemented ideas
Idea #126: Difficulty to manage some CSS and JS with hard coded information

Written by Shnoulle the 23 Mar 10 at 12:11. Related project: 1.x all. Status: New
Rationale
Hello,

Actually there are some hardcoded style.

For exemple for mandatory question we had in qanda.php :

<strong><br /><span class='errormandatory'>

And a lot of other font color='orange' .

This made non-semantic survey and more difficult to use CSS in a good way.

Tags: Template

1
votes
up equal down
Solution #1: Remove all non-semantic information from php code
Written by Shnoulle the 23 Mar 10 at 12:11.
We can use some value of semantic, for example : span , div , p , strong , em in code with some class.

For errormandatory, just a <strong class="errormandatory"> and just one thing for all.

Problem : template had to be modified : if the semantic way is good enough, we can just look at default and limespired template.


1
votes
up equal down
Solution #2: Modify template ability with conditionnal thing
Written by Shnoulle the 23 Mar 10 at 12:19.
Some of template sytem had the ability to make conditionnal branch.

For example smarty :
if $logged_in
Welcome, $name!
else
hi, $name
/if


We can use something lime that :
{if QUESTION_MAN_MESSAGE}{QUESTION_MAN_MESSAGE}{/if}

Or more easy for template maker :
{optionnal_code QUESTION_MAN_MESSAGE optionnal_code}

and QUESTION_MAN_MESSAGE are only text from langage.

This is more difficult to do i think. (i can't help, but i can help to the first solution)
-2
votes
up equal down
Solution #3: translate CSS class names on the fly
Written by evan the 23 Apr 10 at 06:02.
I did a lot of work putting in the classes to make it easier for designers to style LimeSurvey by moving styling out of hard coded (and invalid) HTML styling into easily (with the right knowledge) customisable CSS. Most of these classes names use meaningful if your survey is in English. If your survey is not in English then the classes are not meaning full so do not contribute to the semantic quality of the survey.

The following might be a slightly weird solution but...

One possible solution is to parse both the template files and CSS files when the survey is activated, dumping the cached versions of these files into a locale based templates directory.

Also on the same idea. Have a parser to translate class and ID names in template.css files into other languages to make it easier for non-english speakers to style templates.
0
votes
up equal down
Solution #4: Modify template ability with conditionnal thing #2
Written by Shnoulle the 25 May 10 at 14:22.
in common.php

Replace
if (strpos($line, "QUESTION_HELP") !== false) $line=str_replace("QUESTION_HELP", $question['help'], $line);

by

if(preg_match("~(.*)(\)(.*)QUESTION_HELP(.*)(\)(.*)~",$line)$line=preg_replace( "~(.*)(\)(.*)QUESTION_HELP(.*)(\)(.*)~","$1$3$question['help']$4$6",$line);


I put some diff on bugtracker after 1.90 was out.

Propose your solution


Duplicates


Comments
No comments.

Post your comment