[pmwiki-users] FAQ Page Layout -- The Easiest Way . . .

Ben Wilson dausha at gmail.com
Sun Aug 7 09:16:05 CDT 2005


"The more complex you make the plumbing, the easier it is to stop up the
drain."

(Ex.: http://gmtoolbox.org/Espace/index.php/PmWiki/FAQ)

Guys, I have continued to say there is *no* reason to change the Q:/A:
behavior, and I remain by that contention. All you need to do is
encapsulate the entire FAQ in a DIV statement, as I demonstrate below.
Then, turn off the markup for the A:.

---- In local/config.php ----
Markup('^A:', 'block', '/^(A:.*)$/', "$1"); # or maybe
Markup('^A:', 'block', '/^A:(.*)$/', "$1");

---- in Skin's stylesheet ----
div.faq p {
   margin-left:    3em;
}
div.faq div.q {
   border:          1px solid #999;
   background:      #CCC;
}

---- On Page ----
(:div class=faq:)
Q: Question goes here
A: Answer

Q: Another ruddy question
A: Another answer.
(:divend:)

----

The result is demonstrated on the page I linked above. The only change
this requires is that A: markup be turned off.

I know there's a way to detect if Q: is being used on a page--which
would allow a recipe to add the DIV class=faq automagically for the
truly lazy amongst us. I'll try to whip something up later.

Ben

> George J. De Bruin wrote:
> 
>> I'm going to step into the fire here and make a
>> suggestion...:)
>>
>>
>>> I should say first off I don't mean to come off
>>
>>
>> so adversarial. I'm a
>>
>>> proponent of KISS and of not fixing what is not
>>
>>
>> broken.
>>
>> I'd agree, and I think the markup could be
>> something like this:
>>
>>
>>> (:Q Question goes here:)
>>> (:A:)
>>> Answer goes here.
>>> (:Aend:)
>>
>>
>>
>> How about, though, making them two seperate
>> blocks:
>>
>> (:Q opt="":)
>> Question goes here
>> (:Qend:)
>>
>> (:A opt="":)
>> Answer goes here.
>> (:Aend:)
>>
>> Where the "opt=" sections are could be multiple
>> formatting options: Larg Q & A's, Color settings,
>> etc.
>>
>> Plus, this formation would possibly allow for
>> future expansion, like using nesting for related
>> questions:
>>
>> (:Q opt="TopQuestion":)
>> Top question here...
>> (:Q opt="SubQuestion1":)
>> Sub-question here...
>> (:Qend opt="SubQuestion1":)
>> (:Qend opt="TopQuestion:)
>>
>> (:A indent=true:)
>> Answer the questions here
>> (:Aend:)
>>
>>
>> This isn't to say that all of this needs to be
>> done now...  I'm thinking ahead for possible
>> expansion that wouldn't have to change the syntax
>> of the markup.  (IE, would be backwards
>> compatible.)
>>
>> // George





More information about the pmwiki-users mailing list