WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • How to make code snippets for WYSIWG
  • Print
Pages: [1]   Go Down

Author Topic: How to make code snippets for WYSIWG  (Read 7147 times)

sayf_theone

  • Guest
How to make code snippets for WYSIWG
« on: October 12, 2009, 06: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 :-)
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: How to make code snippets for WYSIWG
« Reply #1 on: October 12, 2009, 06: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
Web developer

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: How to make code snippets for WYSIWG
« Reply #2 on: October 12, 2009, 06:46:47 PM »
Hello Ivan,
he means the title of the whole page, I guess ;-)

KR,
Stefek
Logged
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: How to make code snippets for WYSIWG
« Reply #3 on: October 12, 2009, 07:13:49 PM »
He can generate the title with

Code: [Select]
<?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 :)
Logged
Web developer

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: How to make code snippets for WYSIWG
« Reply #4 on: October 12, 2009, 07:22:41 PM »
This is a cool droplet, Ivan.

Thumbsup!

Regards,
Stefek
Logged
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: How to make code snippets for WYSIWG
« Reply #5 on: October 12, 2009, 07:53:50 PM »
I just added one line :p

Well see if this is what sayf_theone  needs :)

cheers
Logged
Web developer

sayf_theone

  • Guest
Re: How to make code snippets for WYSIWG
« Reply #6 on: October 13, 2009, 02:15:55 PM »
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 :(
 
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: How to make code snippets for WYSIWG
« Reply #7 on: October 13, 2009, 03: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
Web developer

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • How to make code snippets for WYSIWG
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2