<![CDATA[ [プラグイン] PHx notags 改良版 - My Forums]]> https://forums.modx.com/thread/?thread=56650 <![CDATA[ [&#12503;&#12521;&#12464;&#12452;&#12531;] PHx notags &#25913;&#33391;&#29256;]]> https://forums.modx.com/thread/56650/phx-notags#dis-post-332766 notagsを使わないと、divなどの余計なhtmlタグを読み込んでしまい、コール側のレイアウトが崩れてしまいます。
なんとかimgタグだけを残し、あとはnotagsで、ということを実現できました。
これで、トップページなどで記事の一部を画像付きで表示することが可能になりました。

改造は、/assets/plugins/phx/phx.parser.class.inc.phpの250行目の
					case "notags": $output = strip_tags($output); break;


					case "notags":
					  $notags = $modifier_value[$i];
						$output = strip_tags($output,$notags);
						break;

に変えます。
そして、PHxは、例えば、
[+content:notags=`<font><img>`:limit=`500`+]

とします。すると、contentで、<font>と<img>を除くhtmlタグが除去されたものが出力されます。

phpのstrip_tagsのオプションを利用したものです。



[green]リソースの情報[/green]

[table]
[tr][td]モデファイ[/td][td]★wmo[/td][/tr]
[tr][td]リソース名[/td][td]★phx notags 改造版[/td][/tr]
[tr][td]バージョン[/td][td]★2.1.2 +[/td][/tr]
[tr][td]ライセンス[/td][td]★GPL[/td][/tr]
[tr][td]動作環境[/td][td]★MODx 0.9.6 +[/td][/tr]
[tr][td]リソースの種別[/td][td]★プラグイン[/td][/tr]
[tr][td]タグ[/td][td]★phx[/td][/tr]
[/table]]]>
MEGU Aug 31, 2008, 01:46 AM https://forums.modx.com/thread/56650/phx-notags#dis-post-332766