Giving back to a community: FCKeditor - User styles in News module

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
KO
Power Poster
Power Poster
Posts: 562
Joined: Mon Nov 06, 2006 7:55 pm
Location: Helsinki, Finland

Giving back to a community: FCKeditor - User styles in News module

Post by KO »

As we've gotten so much out from this wonderful CMSMS project we would like to give something back to ya all.

We had a problem where no user styles could be given in News module by FCKeditor like you can when editing pages if styles are given in FCKeditor "styles" tab. This requires that you create template called "News" and attach stylesheets needed to it. We've tried this in CMSMS 1.0.4 News module (What ever version it is).

On News.module.php at very end before last "}"

add new function

Code: Select all

	
	/************ BO edit ***************/
	function getStyleSheet()
	{
	    global $gCms;
	    $templateops = & $gCms->GetTemplateOperations();
		$alltemplates = $templateops->LoadTemplates();
	
		if (count($alltemplates) > 0)
		{
		   foreach ($alltemplates as $onetemplate)
		   {
		       if ($onetemplate->name == 'News')
			      $templateid = $onetemplate->id;
		   }
		}
    	$stylesheet = '../stylesheet.php?templateid='.$templateid;
		return $stylesheet;
	}
	/********************EO edit************************************/

	
On action.addarticle.php

on very beginning of file you find

Code: Select all

<?php
if (!isset($gCms)) exit;

Add

Code: Select all

<?php
if (!isset($gCms)) exit;

	/************ BO edit ***************/
    $stylesheet = $this->getStyleSheet();
    /****************EO edit ****************************/
		
In same file change (around line 138)

Code: Select all

$this->smarty->assign('inputcontent', $this->CreateTextArea(true, $id, $content, 'content'));
$this->smarty->assign('inputsummary', $this->CreateTextArea(true, $id, $summary, 'summary', '', '', '', '', '80', '3'));
to

Code: Select all

	$this->smarty->assign('inputcontent', $this->CreateTextArea(true, $id, $content, 'content','','','',$stylesheet));
	$this->smarty->assign('inputsummary', $this->CreateTextArea(true, $id, $summary, 'summary', '', '', '', $stylesheet, '80', '3'));
On file action.editarticle.php at the beginning you find ..

Code: Select all

<?php
		if (!isset($gCms)) exit;

Add

Code: Select all

<?php
		if (!isset($gCms)) exit;

	/************ BO edit ***************/
    $stylesheet = $this->getStyleSheet();
    /**************EO edit*********************/
		
On same file around line 199 change

Code: Select all

$this->smarty->assign('inputcontent', $this->CreateTextArea(true, $id, $content, 'content'));
$this->smarty->assign('inputsummary', $this->CreateTextArea(true, $id, $summary, 'summary', '', '', '', '', '80', '3'));
to

Code: Select all

$this->smarty->assign('inputcontent', $this->CreateTextArea(true, $id, $content, 'content','','','',$stylesheet));
$this->smarty->assign('inputsummary', $this->CreateTextArea(true, $id, $summary, 'summary', '', '', '', $stylesheet, '80', '3'));
Tried it briefly and now the styles attached to Template called "News" are able to be selected also in news module. Hope it works for you.

Have fun,

Keijo
jack4ya
Power Poster
Power Poster
Posts: 294
Joined: Thu Oct 19, 2006 10:07 am

Re: Giving back to a community: FCKeditor - User styles in News >>TinyMCE ??

Post by jack4ya »

Would this work with the TinyMCE editor also??
KO
Power Poster
Power Poster
Posts: 562
Joined: Mon Nov 06, 2006 7:55 pm
Location: Helsinki, Finland

FCKeditor - User styles in News module - TinyMCE

Post by KO »

No idea. Very little experience from TinyMCE.
Post Reply

Return to “Modules/Add-Ons”