Some basic questions

4 posts by 2 authors in: Forums > CMS Builder
Last Post: February 5, 2010   (RSS)

By fleff - January 25, 2010

1. How does my client change the font in a wysiwyg field? He can change the font size, color, etc. but what about the font family?

2. Is there a difference between the browser-displayed font size created in the wysiwyg field and a normal HTML font size -- say, 4(14pt) in the wysiwyg dropdown which shows "medium" in the HTML? My client has run into a problem where the font sizes look different in the entries when entered by different people even though all entries show a font size of 4(14pt). They are using CMSB 1.33 and are used to that interface. I use pixels in my style sheets, not points which, I believe, are meant for print display, not screen display. Might this cause the problem?

3. Why does the wysiwyg field insist on putting in a <p> tag that it won't let me remove in the HTML view? It keeps putting it back. I read in the forum about creating a <p> style in my CSS file that sets the top and bottom margins to 0, but this would then apply to all paragraph tags, wouldn't it? There are times when I don't want the line space created by this tag.

Thanks for your help,

Farnham

Re: [fleff] Some basic questions

By Chris - January 25, 2010

Hi Farnham,

2. I don't believe there's any way to modify the options in the fontsizeselect dropdown, but you could use the styleselect dropdown instead. You can supply your own CSS styles (including specific font pixel sizes) in cmsAdmin/lib/wysiwyg.css (see .exampleClass in that file) and they'll appear in a dropdown for your user. To enable styleselect, modifying a line in cmsAdmin/lib/wysiwyg.php. Change this line:

theme_advanced_buttons1 : "formatselect,fontsizeselect,bold,italic,underline,|,justifyleft,justifycenter,justifyright,|,bullist,numlist,|,outdent,indent,|,removeformat,fullscreen",

to this: (new code in red)

theme_advanced_buttons1 : "formatselect,styleselect,fontsizeselect,bold,italic,underline,|,justifyleft,justifycenter,justifyright,|,bullist,numlist,|,outdent,indent,|,removeformat,fullscreen",

Depending on how your client needs to generate content, this may solve your problem #1 as well. If not...

1. You can add a font dropdown to TinyMCE by modifying a line in cmsAdmin/lib/wysiwyg.php. Change this line:

theme_advanced_buttons1 : "formatselect,fontsizeselect,bold,italic,underline,|,justifyleft,justifycenter,justifyright,|,bullist,numlist,|,outdent,indent,|,removeformat,fullscreen",

to this: (new code in red)

theme_advanced_buttons1 : "formatselect,fontselect,fontsizeselect,bold,italic,underline,|,justifyleft,justifycenter,justifyright,|,bullist,numlist,|,outdent,indent,|,removeformat,fullscreen",

3. This is a tricky problem. One solution might be to wrap your wysiwyg output in your viewers with a classed div, then you can supply a CSS rule which targets only <P> tags in wysiwygs. For example:

<style>
.wysiwyg_content P { margin: 0; }
</style>
<div class="wysiwyg_content"><?php echo $record['content'] ?></div>

I hope this helps! Please let me know if you have any questions.
All the best,
Chris

Re: [fleff] Some basic questions

By fleff - February 5, 2010

The wysiwyg.php additions work just fine and I don't understand why you don't offer the font-family menu as a regular feature in the wysiwyg field. Thanks again for sending it along. CMSB is great!

Farnham