 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
amosmos
Joined: 08 Apr 2008 Posts: 2
|
Posted: Tue Apr 08, 2008 11:45 am Post subject: quickform Renderer Tableless - css stylesheet |
|
|
Hi,
Sorry for this complete beginner question.
How do I use the css stylesheet in my code? where do I copy it too?
Do I just use it inside the php file that I use (like the contact.php example)? If so, how will I know which classes and ID's the package generate?
Thank you,
Amos |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1011
|
Posted: Tue Apr 08, 2008 1:15 pm Post subject: Re: quickform Renderer Tableless - css stylesheet |
|
|
| amosmos wrote: | How do I use the css stylesheet in my code? where do I copy it too?
Do I just use it inside the php file that I use (like the contact.php example)? If so, how will I know which classes and ID's the package generate? |
The contact.php example actually already include the stylesheet. You could start with this example, and modify it according to your needs.
Another possibility is to use an already existing form (that is built with HTML_QuickForm), to add the stylesheet to that page, and to tell QuickForm to use the tableless renderer (as shown in the example and in the manual).
I'm not sure about your last question. The IDs that are added to the generated form are the same IDs that you assign via the 'name' parameter to the form elements (in the addElement() call). The used classes can be found in the example stylesheet.
Does this answer your questions? |
|
| Back to top |
|
 |
amosmos
Joined: 08 Apr 2008 Posts: 2
|
Posted: Tue Apr 08, 2008 2:19 pm Post subject: |
|
|
well i think i understand what you answered.
basically, in order to use the renderer, one has to copy-paste the css code from the stylesheet that came with package into his php file, correct?
at the beginning i thought that there is a way to "tell" quickform_renderer_tableless where is the CSS file, or even better, just have it read a certain CSS file by default (lets say the one that came with it) and give me the ability to supply the renderer with a new one if i want to - maybe something like:
$renderer->setNewCssFile('some directory here')
this way you can just start right away with a styled form, and if you have minor changes to it you just open the attached stylesheet and make those edits. the code stays clean, design and functionality stays separated, and time is saved.
anyway, as an average (or maybe less then the average) user of this package, i would recommend detailing a bit more in the manual about the need to copy the CSS stylesheet inside the php file itself. i think that it is also important to put some comments in the "Introduction" example where the css should go. something like:
/*CSS styles goes here
You can use the example stylesheet as a starting point */
form{
.......
}
it took me sometime to understand it.
as for my second question, are all the classes generated by the package are described in the example stylesheet?
before i finish it is important for me to thank you so much for this wonderful package and for your quick answer to my problem.
amos |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1011
|
Posted: Tue Apr 08, 2008 3:33 pm Post subject: |
|
|
| amosmos wrote: | | basically, in order to use the renderer, one has to copy-paste the css code from the stylesheet that came with package into his php file, correct? |
Right. Of course, you can also just reference the stylesheet, e.g.:
| Code: |
<link rel="stylesheet" type="text/css" href="stylesheet.css">
|
| amosmos wrote: | at the beginning i thought that there is a way to "tell" quickform_renderer_tableless where is the CSS file, or even better, just have it read a certain CSS file by default (lets say the one that came with it) and give me the ability to supply the renderer with a new one if i want to - maybe something like:
$renderer->setNewCssFile('some directory here')
|
This would be a good idea if HTML_QuickForm (QF) would generate a whole (X)HTML page, and not just a form. But that's not the case, QF just generates a form that belongs into the <body> tag, while the stylesheet needs to be in the <head> tag (at least if you want to get valid (X)HTML code).
| amosmos wrote: | | anyway, as an average (or maybe less then the average) user of this package, i would recommend detailing a bit more in the manual about the need to copy the CSS stylesheet inside the php file itself. i think that it is also important to put some comments in the "Introduction" example where the css should go. |
The page that you mention here is just a general introduction into the rendering "framework" of QF. The tableless renderer has its own section in the manual:
http://pear.php.net/manual/en/package.html.html-quickform-renderer-tableless.intro.php
The sentence above the example on that page IMHO already covers your request.
| amosmos wrote: | | as for my second question, are all the classes generated by the package are described in the example stylesheet? |
"described" is maybe the wrong word, but the names should be self-explanatory. If they aren't, don't hesitate to ask.
| amosmos wrote: | | before i finish it is important for me to thank you so much for this wonderful package [...] |
Thanks! |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|