Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rewrote function get_page_content
#1
I needed support for theme url inside of my post for the most current site, and thus I rewrote the old get_page_content for this one:

Code:
function get_page_content() {
        global $content, $SITEURL, $SITENAME, $TEMPLATE, $title, $url;
        
        # Setup theme url
        $theme_url = $SITEURL . "theme/" . $TEMPLATE;
        
        # Strip slashes and decode special characters
        $content = stripslashes(htmlspecialchars_decode($content, ENT_QUOTES));
        
        # Replace data
        $patterns = array('/\{theme_url\}/i', '/\{site_url\}/i', '/\{site_name\}/i', '/\{page_slug\}/i', '/\{page_title\}/i');
        $replacements = array($theme_url, $SITEURL, $SITENAME,  $url, $title);

        # Send the data
        echo preg_replace($patterns, $replacements, $content);
    }

features:
Code:
{theme_url}, {site_url}, {site_name}, {page_slug}, {page_title}
http://nijikokun.com
random stuff. idk.
Reply


Messages In This Thread
Rewrote function get_page_content - by Nijikokun - 2010-01-24, 09:19:50
Rewrote function get_page_content - by ccagle8 - 2010-01-24, 11:28:53



Users browsing this thread: 1 Guest(s)