[New Plugin] "News"

Third Party Plugins to CMSimple - how to install, use and create plugins

Moderator: Tata

spell
Posts: 8
Joined: Tue Nov 13, 2012 7:56 pm

Re: [New Plugin] "News"

Post by spell » Tue Jul 16, 2013 6:10 pm

To add a widget comments which file is correct change?
entry.php ?

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: [New Plugin] "News"

Post by cmb » Tue Jul 16, 2013 6:40 pm

I would do it in plugins/news/index.php. In function news() there is:

Code: Select all

            return '<div class="news-entry">'
                . '<div class="news-entry-title">' . $entry->title() . '<span class="news-entry-title-date">' . date(News::$cf['date_format'], $entry->state()) . '</span></div>'
                . '<div class="news-entry-short">' . evaluate_scripting($entry->short()) . '</div>'
                . '<div class="news-entry-description">' . evaluate_scripting($entry->description()) . '</div>'
                . '</div>'; 
You can change it to:

Code: Select all

            return '<div class="news-entry">'
                . '<div class="news-entry-title">' . $entry->title() . '<span class="news-entry-title-date">' . date(News::$cf['date_format'], $entry->state()) . '</span></div>'
                . '<div class="news-entry-short">' . evaluate_scripting($entry->short()) . '</div>'
                . '<div class="news-entry-description">' . evaluate_scripting($entry->description()) . '</div>'
                                . myCommentsWidget($entry->id())
                . '</div>';
The same modification has to be done to newsarchive().

Then you can define the myCommentsWidget() function in cmsimple/userfuncs.php (so it won't get overwritten with the next update of the news plugin):

Code: Select all

function myCommentsWidget($id)
{
    global $hjs;

    $hjs .= '<script type="text/javascript>Some JavaScript for the HEAD element</script>';
    return 'some HTML';
}
Christoph M. Becker – Plugins for CMSimple_XH

spell
Posts: 8
Joined: Tue Nov 13, 2012 7:56 pm

Re: [New Plugin] "News"

Post by spell » Tue Jul 16, 2013 7:27 pm

Tnank, Christoph.
With your help, all as always works

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: [New Plugin] "News"

Post by cmb » Tue Jul 16, 2013 7:42 pm

Looks great! :)
Christoph M. Becker – Plugins for CMSimple_XH

utaka
Posts: 52
Joined: Fri Sep 18, 2015 6:00 am
Location: japanese
Contact:

Disappearing title : function fgetcsv()

Post by utaka » Tue Dec 01, 2015 11:19 am

I tested Ver 1.1.1.

Disappearing title.
[ external image ]

http://php.net/manual/en/function.fgetcsv.php
Note:
Locale setting is taken into account by this function. If LANG is e.g. en_US.UTF-8, files in one-byte encoding are read wrong by this function.
Fix.

Code: Select all

##################
#
# 
## OPEN news/config/config.php
## Add to About Line 44 
	/**
	 * Set locale for CSV.
	 * @var
	 */
	$plugin_cf['news']['csv_locale']="";

## OPEN news/languages/en.php
## Add to About Line 93 

	$plugin_tx["news"]["cf_csv_locale"]="Setting the setlocale function: set when the title / content of the article does not appear/strangeness setlocale(LC_ALL, set value) are used. See http://php.net/manual/en/function.setlocale.php ";


## OPEN news/helper/csv.php
## Find  to About Line 47 
	public static function parse($file, $delimiter, $enclosure)
	{
 ## After Add to

// Set locale
	if(News::$cf['csv_locale'] != ''){
		setlocale(LC_ALL,News::$cf['csv_locale']);
	}

##############################
*In my case(Japansese)
$plugin_cf['news']['csv_locale']="ja_JP.UTF-8";

[ external image ]
******************************************************
Japan Site http://cmsimple-jp.org
Twitter Googe+ github
*I English is not a good . I'm sorry...
*Ich habe nicht eine gut Deutsch. Es tut mir leid ...
*Jeg kender ikke dansk
--Powered by Google Translate-----

utaka
Posts: 52
Joined: Fri Sep 18, 2015 6:00 am
Location: japanese
Contact:

Don't Show ALL Entories

Post by utaka » Fri Dec 04, 2015 4:01 am

In help file ,
news('', '-13 days'); // All entries of the last 13 days in all categories.
But , news('' ,.... don't work .

Fix.

Code: Select all

#
### OPEN news/index.php
#### FIND 
	elseif (is_array($category))
	{
		foreach ($category as $c)
		{
			if (News_Category::category_exists($c))
			{
				$c = new News_Category($c);
				$entries = $c->entries();
				$all = array_merge($all, $entries);
			}
		}
	}
#### After Add 
	else{
	//Get all categories.
		$categories = News_Category::categories();
		foreach ($categories as $c)
		{
			$c = new News_Category( $c->name());
			$entries = $c->entries();
			$all = array_merge($all, $entries);
		}
	}
******************************************************
Japan Site http://cmsimple-jp.org
Twitter Googe+ github
*I English is not a good . I'm sorry...
*Ich habe nicht eine gut Deutsch. Es tut mir leid ...
*Jeg kender ikke dansk
--Powered by Google Translate-----

utaka
Posts: 52
Joined: Fri Sep 18, 2015 6:00 am
Location: japanese
Contact:

Do not show filebrowser: tinyMCE4CMSimple_XH

Post by utaka » Sun Dec 06, 2015 5:52 pm

Do not show filebrowser,

News PluginVersion: 1.1.1
+ tinyMCE4CMSimple_XH version 1.2.5 - 2015-08-11
+CMSimple_XH 1.6.7

Code: Select all

#######################
# Do not show filebrowser 
#
#For tinyMCE4CMSimple_XH version 1.2.5 - 2015-08-11
#
#
# Caution: does not necessarily with this modification is correct!!
#######################
#
# OPEN : news/admin.php

### About Line 45

if (isset($news))
{
	global $sn;

### Change / Replace With

if (isset($news))
{
//	global $sn;
	global $sn,$edit;

### Find 
#About Line430

		if ($action == 'add'
			AND $category !== FALSE)
		{

## After Add 
 		$edit = true; //Add 

### Find 
#About Line 605
 
		if ($action == 'edit'
			AND $entry !== FALSE)
		{

## After Add 
 		$edit = true; //Add 

### # OPEN : tinymce4/init.php
#
## Find

    $temp = str_replace(
        '"%FILEBROWSER_CALLBACK%"',
        $xh_editor ?
        $_SESSION['tinymce_fb_callback'] :
        '""',
        $temp
    );


## Cange / Replace With

    $temp = str_replace(
        '"%FILEBROWSER_CALLBACK%"',
//        $xh_editor ?
//        $_SESSION['tinymce_fb_callback'] :
//        '""',
        $_SESSION['tinymce_fb_callback'],
        $temp
    );
And This Fix by manu .

Code: Select all

    //tinymce4/init.php about line 32
    if (!(XH_ADM && $edit)) {   // no filebrowser, if editor is called from front-end
            $_SESSION['tinymce_fb_callback'] = ''; // ADD THIS LINE - suppress filebrowsercall
            return '';
        }
http://cmsimpleforum.com/viewtopic.php? ... =10#p50148
******************************************************
Japan Site http://cmsimple-jp.org
Twitter Googe+ github
*I English is not a good . I'm sorry...
*Ich habe nicht eine gut Deutsch. Es tut mir leid ...
*Jeg kender ikke dansk
--Powered by Google Translate-----

Post Reply