Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 12:59:28 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155533 Posts in 21713 Topics by 7738 Members
Latest Member: Pattieardathfe
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: How to make code snippets for WYSIWG  (Read 960 times)
sayf_theone

Offline Offline

Posts: 21


« on: October 12, 2009, 05:31:10 PM »

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 smiley
Logged
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #1 on: October 12, 2009, 05:39:21 PM »

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

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

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4884



« Reply #2 on: October 12, 2009, 05:46:47 PM »

Hello Ivan,
he means the title of the whole page, I guess wink

KR,
Stefek
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #3 on: October 12, 2009, 06:13:49 PM »

He can generate the title with

Code:
<?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 Smiley )

Code: (txtpiece)

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 Smiley

good luck Smiley
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4884



« Reply #4 on: October 12, 2009, 06:22:41 PM »

This is a cool droplet, Ivan.

Thumbsup!

Regards,
Stefek
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #5 on: October 12, 2009, 06:53:50 PM »

I just added one line :p

Well see if this is what sayf_theone  needs Smiley

cheers
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
sayf_theone

Offline Offline

Posts: 21


« Reply #6 on: October 13, 2009, 01:15:55 PM »

Thank you very much  smiley

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 Sad


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 Sad
 
Logged
crnogorac081
AddOn Development
*
Offline Offline

Posts: 1706



« Reply #7 on: October 13, 2009, 02:08:54 PM »

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
Logged

Wow, I coded something myself: PM Messanger Modul ,Searchbox with suggestions
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!