Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: questions - Using Textile with sNews 1.7  (Read 7001 times)

Dave Porter

  • Newbie
  • *
  • Karma: 0
  • Posts: 35
questions - Using Textile with sNews 1.7
« on: June 26, 2008, 02:27:35 AM »

Hi All,

Have not visited snews for a while so just catching up.

1)  Where can I see what new features are in 1.7 - downloaded the zip file but the changes.txt does not really help - more of a developers list of changes.

2)  Is there anyway to use Textile as the rendering engine ?  I hate using WYSIWYG editors!

cheers, Dave
« Last Edit: July 06, 2008, 12:47:48 AM by Keyrocks »
Logged

Joost

  • Guest
Re: questions
« Reply #1 on: June 26, 2008, 06:08:48 AM »

Welcome back Dave,

sNews default doesn't have a WYSIWYG editors, but if you want a different editor, maybe this one of these is for you:
http://markitup.jaysalvat.com/home/
http://snewscms.com/forum/index.php?topic=7101.msg49677#msg49677
Logged

Dave Porter

  • Newbie
  • *
  • Karma: 0
  • Posts: 35
Re: questions
« Reply #2 on: June 26, 2008, 07:37:56 AM »

Thanks Joost - I know snews does not have wysiwyg editor as a default, but I want to implement Textile instead of an editor !

I'm happy to do it - it is actually quite simple, but I just might need some help working out where to place the code.

cheers, Dave
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: questions
« Reply #3 on: June 26, 2008, 12:12:36 PM »

Dave, I suggest you fiddle around with the available version for now. Final is still being worked on and cleaned up a tad. Although I believe we hav a handle on issues found, it may not be wise to use it in a production environment as yet.
Logged
Of all the things I have lost, it is my mind that I miss the most.

Dave Porter

  • Newbie
  • *
  • Karma: 0
  • Posts: 35
Re: questions
« Reply #4 on: June 26, 2008, 12:48:52 PM »

Thanks Philmoz,

I probably should have entered my Textile question in a different section of the forums - I did not wish to imply that I wanted to add the Textile feature specifically to 1.7, 
I just want the feature in general...

I guess I thought that not having to enter html into the body of a article might be replaced by some other rendering option!

cheers, Dave
Logged

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: questions
« Reply #5 on: June 26, 2008, 02:12:03 PM »

Dave,
What is Textile?
You can give me a link?
Logged

TheTick

  • Full Member
  • ***
  • Karma: 6
  • Posts: 105
Re: questions
« Reply #6 on: June 26, 2008, 02:21:45 PM »

Logged

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: questions
« Reply #7 on: June 26, 2008, 02:23:08 PM »

Thank you TheTick!
Logged

Dave Porter

  • Newbie
  • *
  • Karma: 0
  • Posts: 35
Re: questions
« Reply #8 on: June 26, 2008, 04:14:22 PM »

Plus WikiPedia has a good entry on it !

http://en.wikipedia.org/wiki/Textile_(markup_language)

It is very easy to learn & screen's end users from having to learn HTML.

cheers, Dave
Logged

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: questions - Using Textile with sNews 1.7
« Reply #9 on: July 01, 2008, 09:35:28 PM »

This is functional.. I saw that code, I think is easy to implement... stay tunned :) . For 1.6 of course... For 1.7 not yet but I think will work with no problems.
« Last Edit: July 06, 2008, 12:48:20 AM by Keyrocks »
Logged

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: questions - Using Textile with sNews 1.7
« Reply #10 on: July 04, 2008, 10:26:21 PM »

I tested it on my package and is working. I saw it not have problems displaying articles already written in html code...
You must have classTextile.php file on same directory with snews.php.

On default sNews package (1.6) you must first change function file_include with this one:

Code: [Select]
<?php
function file_include($text$shorten) {

$fulltext substr($text0$shorten);

$inc strpos($fulltext'[/include]');

if ($inc 0) {

$text str_replace('[include]''|&|'$fulltext);

$text str_replace('[/include]''|&|'$text);

$text explode('|&|'$text); 

$num count($text);

$extension explode(','l('file_include_extensions'));

for ($i 0; ; $i++) {

if ($i == $num) {break;}

if (!in_array(substr(strrchr($text[$i], '.'), 1), $extension)) {return substr($text[$i], 0);}

else {

if (preg_match("/^[a-z0-9_\-.\/]+$/i"$text[$i])) {

$filename $text[$i];

file_exists($filename) ? include($filename) : print l('error_file_exists');

} else {echo l('error_file_name');}

}

}

} else {
      return 
$fulltext;
    }

}

?>

Before function center insert this code:
//mod textile(
require_once('classTextile.php');
//)

Then, in function center, right before while,
insert this:
//mod textile(
$textile = new Textile();
//)

In while cycle, locate this line
file_include(str_replace('[break]', '', $text), $shorten);
And replace with this:
//mod textile(
$in = file_include(str_replace('[break]', '', $text), $shorten);
echo $textile->TextileThis($in);

//)


In function extra, locate:
file_include($r['text'], 9999000);

and replace with
echo file_include($r['text'], 9999000);


I hope this is all...
P.S.
In this example, comments are not yet textile-fied  but I think you can handle it now. Is easy.
« Last Edit: July 06, 2008, 12:48:33 AM by Keyrocks »
Logged