Jump to content

Remove tags <p>mytext</p> from repeater module's textarea/CKEditor


Recommended Posts

It's possible?
I use this code with the repeater module:

				   <?php foreach($page->ber_MDL_ripetitore as $ber):?>				   
				   
						<li>

							<a class="uk-accordion-title" href="#">
								<div class="fa fa-comments"></div><h2 class="perh2faq"><?=$ber->ber_MDL_domanda?></h2>
							</a>
				   
							<div class="uk-accordion-content">
							
								<p style="color: white;">
							
									<?=$ber->ber_MDL_risposta?>
								
								</p>
								
							</div>				   
				   
						</li>				   
				   
				   <?php endforeach;?>

The html code <a></a> is used to open the text area after a click (I use ui-kit css/js).

I changed the html code from <p></p> to <div></div> but that doesn't work either.
Then I removed CKE and replaced it with simple "textarea", but <p></p> always appears on the sides of the text. It's amazing. I don't know what I'm doing wrong...
Any suggestions?

Link to comment
Share on other sites

  • franciccio-ITALIANO changed the title to Remove tags <p>mytext</p> from repeater module's textarea/CKEditor

If I understand you correctly, in your final HTML you are getting something like this:

<p style="color: white;">
	<p>
		Your text goes here.
	</p>
</p>

If what you need is simply to remove the first and last <p> tags from $ber_MDL_riposta, you can use:

preg_replace('^<p.*?>|<\/p>$', '', $ber_MDL_risposta)

But if it seems tags are being inserted, do you have a TextFormatter applied to the field (Details tab)? When you switched to a textarea field (without CKEditor), did you check that the data in the field does not include tags? Have you used "Page Source" or "View Source" (or similar) to check the HTML?

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...