How to make code snippets for WYSIWG

crnogorac081

First of all, do not change droplet code !

Just go to backend - pages and see section if of wysiwyg page from which you want to extract part of text..

Then in another wysiwyg section where you want to put this text, insser this doplet:

[[txtpiece?section=1&txt_start=0&txt_lenght=100]]

Just change number 1 with your section id !!! thats all, and dont touch droplet code, jusst copy-paste it..

cheers
Web developer

sayf_theone

Thank you very much  :-)

but it don't work

     global $database, $wb;
$sections=explode(",",$section);
shuffle($sections);
$get_content = $database->query("SELECT content FROM ".TABLE_PREFIX."mod_wysiwyg WHERE section_id = '$sections[0]'");
$fetch_content = $get_content->fetchRow();
$content = ($fetch_content['content']);
$wb->preprocess($content);
return substr($content,$txt_start,$txt_lenght).'...';
$a=substr (51,6,5);
echo $a;


nothing displayed :(


what i want to do is :
1- add a new input like "Snap for the Page"  in "Modify Page Settings" .  in the main page i want to put a box that snap or take what i entered in "Snap for the Page"  and show it randomly ( from any page )

2- Input a new Input " page name "  in "Modify Page Settings" and save it in database so i can get it
  like echo PAGE_TITLE
  like echo PAGE_NAME * new


i will be regretful  if you help me.

i know php, but i can't work with the WebsiteBaker's files :(
 

crnogorac081

I just added one line :p

Well see if this is what sayf_theone  needs :)

cheers
Web developer

Stefek

This is a cool droplet, Ivan.

Thumbsup!

Regards,
Stefek
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

crnogorac081

He can generate the title with


<?php
echo PAGE_TITLE;
?>


or if he wants menu title then

echo MENU_TITLE


But he said also "a little of text.."

Try with this droplet, this is ShowSection droplet from AMASP (little changed for your needs :) )

Code (txtpiece) Select


global $database, $wb;
$sections=explode(",",$section);
shuffle($sections);
$get_content = $database->query("SELECT content FROM ".TABLE_PREFIX."mod_wysiwyg WHERE section_id = '$sections[0]'");
$fetch_content = $get_content->fetchRow();
$content = ($fetch_content['content']);
$wb->preprocess($content);
return substr($content,$txt_start,$txt_lenght).'...';



Name your droplet: txtpiece and try this call:

[[txtpiece?section=51&txt_start=0&txt_lenght=100]]

Where 51 is your sectio number, txt_start is starting point, txt_lenght is how much characters you want to display from starting point..

Example: If your text is: Hello world!  , droplet [[txtpiece?section=51&txt_start=6&txt_lenght=5]] wil display: world...

Just note to input correct section number :)

good luck :)
Web developer

Stefek

Hello Ivan,
he means the title of the whole page, I guess ;-)

KR,
Stefek
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

crnogorac081

Could you please specify what exactly you need ? Or little example ?

By the way, there is no title in wysiwyg ... only in news...
Web developer

sayf_theone

Can anyone tell me please how to make code snippets for WYSIWG take the title and a little of the text.

i have the " Anynews" but its work only with News and not work for WYSIWG.

Please reply as soon as possible.

Thank you all :-)