alconebay Posted November 19, 2008 Share Posted November 19, 2008 Hi, I am trying to use use PHP + CSS Dynamic Text Replace (http://www.joaomak.net/util/dtr/). I got it to work fine running a "normal" web site, but when I put it into wordpress it would not work. However, the creator of the script added instructions for making it work within CMSs like wordpress. His instructions were: If you are using this script in a CMS that doesn't allow you to use output buffering functions, simply comment the line with `ob_start('PCDTR_init');` in the class.php file and, in your code, execute $content=PCDTR_init($content); with your generated content string. I commented out the ob_start line. I understood that. But what does the $content part mean? The full instructions are below. 1. In the beggining of the HTML insert: <?php include 'pcdtr/php/class.php'; ?> And at the bottom: <?php ob_end_flush(); ?> 2. Link the style sheet inside the <head>: <link href="pcdtr/styles.css" rel="stylesheet" type="text/css" /> or inside your css: @import "pcdtr/styles.css"; and start styling! 3. Copy your font files (.ttf or .otf) to the pcdtr folder. OBS: .otf fonts seems to have problems with accents The Code for the page of a normal (non wordpress) web site: <?php include 'pcdtr/php/class.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>PHP + CSS Dynamic Text Replacement Example</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="author" content="joaomak.net" /> <link href="pcdtr/styles.css" rel="stylesheet" type="text/css" /> </head> <body style="padding:2em;background:#d6dee9;"> <p>Replaced Elements:</p> <h1 class="new">PHP & CSS <a href="http://pcdtr.googlecode.com/">Dynamic Text Replacement</a></h1> </body> </html> <?php ob_end_flush(); ?> So what do I do with $content=PCDTR_init($content); to make it work in wordpress? Link to comment https://forums.phpfreaks.com/topic/133281-solved-need-some-terminology-help-execute-x-with-your-generated-content-string-huh/ Share on other sites More sharing options...
Darrel Posted November 19, 2008 Share Posted November 19, 2008 $content refers to the buffered output of the page. PCDTR_init() goes over this buffered content making replacements on the headings in it. So if wordpress uses an output buffer, find it and make the call to PCDTR_init() to it after page content has been executed. Link to comment https://forums.phpfreaks.com/topic/133281-solved-need-some-terminology-help-execute-x-with-your-generated-content-string-huh/#findComment-693239 Share on other sites More sharing options...
alconebay Posted November 19, 2008 Author Share Posted November 19, 2008 ok, I'm still not real sure what I am doing. If I wanted my dynamic text to be "Hello World" and the div class for the dynamic content to be class="dynamic" would it look something like this: <?php include 'pcdtr/php/class.php'; ?> <html> <head> <link href="pcdtr/styles.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="dynamic"><?php echo "$replace";?></div> </body> </html> <?php ob_end_flush(); ?> <?php $replace=PCDTR_init($replace);?> (I tried the code above but it didn't work) Link to comment https://forums.phpfreaks.com/topic/133281-solved-need-some-terminology-help-execute-x-with-your-generated-content-string-huh/#findComment-693475 Share on other sites More sharing options...
alconebay Posted November 19, 2008 Author Share Posted November 19, 2008 After all that, it was a broken link causing the problem. Wordpress has it's own linking system for plugins apparently. Link to comment https://forums.phpfreaks.com/topic/133281-solved-need-some-terminology-help-execute-x-with-your-generated-content-string-huh/#findComment-693554 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.