目標は、ユーザー テキストのグループの段落数をカウントすることです...
(この演習では、常に 5 段落よりも大きいと仮定します)
次に、段落数を 1/2 にして切り捨て、echo "yehhoo"
間に content( ) を入力します。
私が得た方法が$newvalue
あまり良くないことは理解しています。それについても助けてください...
<?php
$choppedup = explode("<p>",$node->field_long_body[0]['safe']);
$choppedpos = count($choppedup);
$choppedpos2 = $choppedpos/2;
$newvalue = floor($choppedpos2);
//I know this is working to here... the rest not so sure.
for($j = 0; $j < $choppedup; $j ++):
print $choppedup[$j];
if ($j == $newvalue):
echo "yehhoo" ;
endif;
endif;
?>
ありがとうございました