Page 1 of 1

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

Posted: Tue Feb 06, 2007 5:02 pm
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

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

Posted: Thu May 10, 2007 8:36 am
by jack4ya
Would this work with the TinyMCE editor also??

FCKeditor - User styles in News module - TinyMCE

Posted: Thu May 10, 2007 9:20 am
by KO
No idea. Very little experience from TinyMCE.