Welcome, Guest. Please login or register.
Did you miss your activation email?
May 24, 2012, 06:55:57 PM

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.
155465 Posts in 21707 Topics by 7732 Members
Latest Member: DarrellDD
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Replace text string in WYSIWYG with code section  (Read 1055 times)
StefanRSA

Offline Offline

Posts: 96



WWW
« on: November 19, 2008, 07:46:42 AM »

Is it in any way possible to change a text string in the wysiwyg section with the code section?

I want to change a text string in a page depending on the URL...

Please help...
Logged

How can the sky be the limit? There is much more behind the sky!!!
thorn

Offline Offline

Posts: 980


WWW
« Reply #1 on: November 19, 2008, 10:12:10 AM »

Hello,

there was such a topic in the german board, recently.
Using a Output-Filter
http://www.websitebaker2.org/forum/index.php/topic,11612.msg69946.html#msg69946
or javascript
http://www.websitebaker2.org/forum/index.php/topic,11612.msg69948.html#msg69948

but maybe it isn't what you are looking for.

thorn
Logged

pcwacht
AddOn Development
*
Offline Offline

Posts: 2856



WWW
« Reply #2 on: November 19, 2008, 11:07:05 AM »

Depending on what you need I would go with the replaceword option

1 - fetch output of content into a variable (ob_start etc)
2 - test for words and execute code depending on the words

this could be done in template

seems easiest to me, you could allso disgard the output for example

John

Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
StefanRSA

Offline Offline

Posts: 96



WWW
« Reply #3 on: November 19, 2008, 11:20:02 AM »

Hi John...

I think your answer looks interesting... Where should I place the ob_start?
Where in my temlate should it be and what do I use as anchor? Would my anchor be the page_content(1);Huh
I actually only need to change one sentence depending on mabe the link???
Logged

How can the sky be the limit? There is much more behind the sky!!!
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2295



WWW
« Reply #4 on: November 19, 2008, 12:37:26 PM »

In your template there is one line that says: page_content();

Replace that with something like:

Code: (untested)
<?php 
  ob_start
();
  
page_content();
  
$content ob_get_contents();
  
ob_end_clean();
  
// do your replacing here like: $content = str_replace ("black", "white", $content );
  
echo $content;

Ruud
Logged

Professional WebsiteBaker Solutions
StefanRSA

Offline Offline

Posts: 96



WWW
« Reply #5 on: November 19, 2008, 12:45:07 PM »

MY OH MY!!! Thanks Ruude!!!!! grin
Logged

How can the sky be the limit? There is much more behind the sky!!!
pcwacht
AddOn Development
*
Offline Offline

Posts: 2856



WWW
« Reply #6 on: November 19, 2008, 07:38:47 PM »

@Ruud, seems to me executiing code snipepts inside wysiwyg fields seems a demand

What about something like this
module wich make you create code attached to name (editing storing etc)

something like [[name]] in wysiwyg's wich will be replaced by code from module then eval and voila
with some imagination one can do loads of things with it.


I think etmoite and modx uses something simular

John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
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!