[pmwiki-users] Using pagelist output with template to output csv

Chris Cox ccox at endlessnow.com
Wed Jan 5 12:28:30 CST 2011


On 01/04/2011 11:18 PM, Patrick R. Michaud wrote:
> On Tue, Jan 04, 2011 at 04:03:13PM -0600, Chris Cox wrote:
>   
>> On 01/04/2011 04:59 AM, Eemeli Aro wrote:
>>     
>>> On 3 January 2011 22:45,  <ccox at endlessnow.com> wrote:
>>>   
>>>       
>>>> I created a pagelist template that extracts some PTVs and the format looks
>>>> like CSV.
>>>>
>>>> With a special skin (basically a do nothing skin) and with localized
>>>> change of content-type, it's almost perfect.... except the pagelist output
>>>> does contain just a bit of html formatting.
>>>>
>>>> So.... anyone got an "easy" way to pull this off?
>>>>         
>>> What exactly is the HTML that's left over? Also, try adding wrap=none
>>> to the (:pagelist:) command.
>>>       
>> <div id='wikitext'>
>> <p>my text, my text, my text </br>
>> my text, my text, my text </br>
>> ..etc..
>> <p>
>> </div>
>>     
>
> Try adding the following to skin.php for your minimal skin:
>
>   # eliminate <div id='wikitext'> ... </div>
>   global $PageTextStartFmt, $PageTextEndFmt;
>   $PageTextStartFmt = '';
>   $PageTextEndFmt = '';
>
>   # eliminate the <br /> at the ends of lines
>   global $HTMLPNewline;
>   $HTMLPNewline = '';
>
>   # eliminate the <p>...</p>
>   global $BlockMarkups;
>   $BlockMarkups['p'] = array('','','',0);
>
> If that doesn't work... perhaps you could send me a copy of your
> minimal skin and/or pagelist template and I can tune it a bit 
> further.
>
> Pm
>   
VERY close... everything eliminated EXCEPT for the <br /> at the end of
the lines.  It works in my case because, for whatever reason, the
Microsoft Excel boyz demand an extraneous field at the end of the csv
lines anyhow... so mine contains the <br /> right now :)

I am a very happy person right now.

What I've done is created a special group that always output the csv
content-type... the idea is to shove pagelists with csv templating into
pages created there and they'll stream CSV out.

(and yes... this is to provide that required spreadsheet output from the
agentless inventory system... for those that know)




More information about the pmwiki-users mailing list