<![CDATA[ no MODx tags rendering in or or - My Forums]]> https://forums.modx.com/thread/?thread=483 <![CDATA[Re: no MODx tags rendering in &lt;pre&gt; or &lt;code&gt; or &lt;whatever&gt;]]> https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or?page=2#dis-post-3835 Quote from: sirlancelot at Apr 17, 2007, 12:16 AM

How bout using to plugin to literally "Remove" everything within <pre> tags and set a placeholder with the content?
There is already this: http://modxcms.com/commentTags-1389.html]]>
doze Apr 17, 2007, 03:22 AM https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or?page=2#dis-post-3835
<![CDATA[Re: no MODx tags rendering in &lt;pre&gt; or &lt;code&gt; or &lt;whatever&gt;]]> https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or#dis-post-3834
Either way, yours or mine, we seem to be copying large amounts of data. It could end up slowing down the system a lot.

Rahul]]>
crossconnect Apr 16, 2007, 07:49 PM https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or#dis-post-3834
<![CDATA[Re: no MODx tags rendering in &lt;pre&gt; or &lt;code&gt; or &lt;whatever&gt;]]> https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or#dis-post-3833
http://modxcms.com/forums/index.php/topic,14042.0.html

Rahul]]>
crossconnect Apr 16, 2007, 07:33 PM https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or#dis-post-3833
<![CDATA[Re: no MODx tags rendering in &lt;pre&gt; or &lt;code&gt; or &lt;whatever&gt;]]> https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or#dis-post-3832
<?php
/** System Events Selected: OnParseDocument */

/** Strip out $source in favor of a placeholder */
if (!function_exists('replace_pre_tags')) {
function replace_pre_tags($source) {
	if (is_array($source)) $source = $source[0];
	static $counter = 1;
	static $in = array('[', ']');
	static $out = array('[', ']');

	$source = str_replace($in, $out, $source);
	
	$ph = 'pre_content_'.$counter++;
	$modx->setPlaceholder($ph, $source);
	return '[+'.$ph.'+]';
}

// Run the replacements
preg_replace_callback('~\<pre>.*?\</pre>~', 'replace_pre_tags', $modx->documentOutput);
?>
On second thought, you wouldn’t really even need to replace the whole tag with a placeholder... But oh well, have fun!]]>
sirlancelot Apr 16, 2007, 07:16 PM https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or#dis-post-3832
<![CDATA[Re: no MODx tags rendering in &lt;pre&gt; or &lt;code&gt; or &lt;whatever&gt;]]> https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or#dis-post-3831 doze Apr 16, 2007, 01:23 PM https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or#dis-post-3831 <![CDATA[Re: no MODx tags rendering in &lt;pre&gt; or &lt;code&gt; or &lt;whatever&gt;]]> https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or#dis-post-3830
http://rahul.rahul.net/modx-hints/fixedpre-tag.html

Rahul]]>
crossconnect Apr 14, 2007, 06:31 AM https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or#dis-post-3830
<![CDATA[Re: no MODx tags rendering in &lt;pre&gt; or &lt;code&gt; or &lt;whatever&gt;]]> https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or#dis-post-3829 Quote from: ScottyDelicious at Apr 28, 2006, 06:15 PM

[<!-- -->[DropMenu]<!-- -->]
That’s how I do it at the moment ... but a plugin would be kinda nice grin]]>
garryn Apr 28, 2006, 05:22 PM https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or#dis-post-3829
<![CDATA[Re: no MODx tags rendering in &lt;pre&gt; or &lt;code&gt; or &lt;whatever&gt;]]> https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or#dis-post-3828
an example you ask! ok:

[<!-- -->[DropMenu]<!-- -->]

would be displayed on the page as [[DropMenu]], but would not be parsed by MODx

-sD-

]]>
ScottyDelicious Apr 28, 2006, 01:15 PM https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or#dis-post-3828
<![CDATA[Re: no MODx tags rendering in &lt;pre&gt; or &lt;code&gt; or &lt;whatever&gt;]]> https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or#dis-post-3827 ]]> Commodore64 Apr 28, 2006, 10:22 AM https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or#dis-post-3827 <![CDATA[Re: no MODx tags rendering in &lt;pre&gt; or &lt;code&gt; or &lt;whatever&gt;]]> https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or#dis-post-3826
	function evalSnippets($documentSource) {
	
	//added by mmd for not parsing <pre> tags part 1
		preg_match_all('~\<pre>(.*?)\</pre>~', $documentSource, $fragments); //looking for <pre> tags, store them in $fragments
		if ($fragmentsCount=count($fragments[1])) {
				for($i=0; $i<$fragmentsCount; $i++) {
					$fragments_replace[1][$i] = str_replace('[[','[*#[',$fragments[1][$i]); //replace snippet calls within
					$fragments_replace[1][$i] = str_replace(']]',']*#]',$fragments[1][$i]); //<pre> tags with other chars
					$documentSource = str_replace($fragments[1][$i],$fragments_replace[1][$i],$documentSource);
				}
		}
	//end part 1
	
		preg_match_all('~\[\[(.*?)\]\]~', $documentSource, $matches);

		$etomite = &$this;

...
		**SNIP**
...
		
                //added by mmd for not parsing pre tags part 2
		$documentSource = str_replace('[*#[','[[',$documentSource); //replace snippet placeholders 
		$documentSource = str_replace(']*#]',']]',$documentSource); //with original
               // end part 2

		return $documentSource;
	}



]]>
MadeMyDay Apr 28, 2006, 09:28 AM https://forums.modx.com/thread/483/no-modx-tags-rendering-in-or-or#dis-post-3826