[pmwiki-users] formatting table in selectquery

Andrew Standfield andy at scruffyco.com
Fri Aug 18 12:30:21 CDT 2006


I haven't actually run SelectQuerry yet, but have bee considering it  
for an upcoming project. So these suggestion are really just things  
you could try. Hopefully they'll help you.

I'd say that CSS is the way to go with formatting the table. I don't  
know if it already has IDs or classes for the table tags, but if it  
doesn't, you could place a div with an ID around the area where the  
output would be displayed. So, for example, if you were using an  
input form like the example on the recipe page, you could do  
something like this:

(:div id="queryresults":)
(:selectquery columns="firstname,lastname,email" tables=people:)
(:input form:)
(:input radio where value="lastname IS NOT NULL":) valid last name
(:input radio where value="email LIKE '%@%'":) valid email
(:input submit value="Run Query":)
(:input end:)
(:divend:)

Then, in your CSS, you could have something like the following:

#queryresults table {
width: 500px;
}

#queryresults table td {
     padding: 5px;
}

#queryresults table th {
     font-weight: bold;
}


Of course, you'd change those values to meet your needs.

As for the conditional output... I'm less sure on this, but it seems  
that you might be able to use the built in conditional functionality.  
Something like:
(:selectquery columns="status,expiredate" tables=members  
options=userid display=custom:)
{(`fieldyouwantchecked` == 'acertainvalue' ?  
'thefieldyouwantdisplayed' : 'anoptionalalternativefield')}

Hope this helps. If it does, let me know, because these are things I  
may need to try myself on the aforementioned project (especially the  
second part).

Andy Standfield
http://www.vertigo25.com/
http://www.ipodnirvana.com/


On Aug 17, 2006, at 10:01 AM, Bronwyn Tarrier wrote:

> I am running selectquery on my wiki and i would like to know if its
> possible to format the table that it outputs at all.
>
> I would like to have some cell padding, have it a bit wider and  
> make the
> header row bold if that's possible.
>
> My second question about select query is how do i make it display one
> field if the contents of another field are a certain value in a custom
> display.
>
> Bronwyn
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://host.pmichaud.com/mailman/listinfo/pmwiki-users





More information about the pmwiki-users mailing list