Laravel displaying html div without images - html

When we are using text editor we can add different html tags. Like image, videos.
But i just want to show text fields. If i try {{$loop->content}} it prints
<p><strong>EXAMPLE</strong></p><img src='/..'>
But when try to {!! $loop->content !!} it prints "EXAMPLE" + "image"
I just want to print "EXAMPLE". Not an image. How can i make this?
Is there a way to do this in laravel shortcodes, php functions or css things? I searched the docs but not found. Thanks in advance.

{{strip_tags($loop->content)}}
Hope this will help you to remove the img tag

Related

Cheerio - get only text from html file

I would like to know if there's a way to only get the text from an XTML loaded to Cherrio.
const html = cheerio.load(originalHtmlString);
how can I access just the content ? without needing to loop through each element.
Thanks in advance
You could use
$('body').text()
or
$.root().text()
but it might not be as nicely formatted as you want.

How to convert plain text to html but keep the display format?

I have one plain text which is program output, but I want to display it in html page. But still I want to keep the formats (like space/tab/enter and etc.), it's just like the code block of stackoverflow, how can I display it properly in html ? Thanks
Use the "pre" and "code" HTML tags:
<pre><code> code in here... </code></pre>
<code> the program</code>

tinymce : how to convert raw html tags?

i used tinymce to allow people to write content. But now i wan't them to edit their own content, i need to use tinymce again.
My problem is in my database, this content is composed of html tags, and when i try to load the text in my tinymce textarea (in edit view), i've got the raw content eg <p> Hello my name is <em>John</em> [...] </p> . But when they written this content, it was with "wysiwyg".
I want to convert this raw html to wysiwig.
here a screenshot of the raw html
and i want it to be like this when they click on "edit my content" button :
I use this:
echo <textarea name="icerik" id="editor1" rows="10" cols="80">'.htmlentities($satir->icerik).'</textarea>;
I use "htmlentities" method in php to convert html code to wysiwyg. When you write that converted text between and , you can get what you want.
Assuming you're using PHP of course. If not, try to search like for example "htmlentities in asp.net" or wait for another answers.
tinyMCE.activeEditor.setContent('<span>html data from your database</span>');
Use this:
strip_tags(stripslashes('row html content'))

Symfony2, transform only <a></a> in link

I created a form with a textarea.
When I try to put HTML in this text area, save my form, and display the new data on my page, I can see all HTML TAGS, without interpretation. It's just normal.
But I need to be interpreted all link tags a>/a>, and only this tag....
How can I do that ? Is there an option with formbuilder ?
I need to do something before saving the data ? When I display the data ? Thanks !
You should just create a custom Twig filter:
http://symfony.com/doc/current/cookbook/templating/twig_extension.html

Inserting labels into image alt tag in Blogger

Just wondering whether anyone knows how to get blogger labels into "alt" tags in an image. I have tried alt="data:post.labels" to no available at all?
Doesn't anyone know how to assist with this on blogger?
P.S - I know about the ‘rel=tag’ - but for the specific template, I want to have the labels appear as text in the alt tags?
Looks like you may be using the XML version of templating Blogger. If that's the case, then you'll need to use something like the below if you want to have the ALT attribute show up with the name of the tag:
expr:alt='data:label.name'
You can use the same principle to display the label/tag in the TITLE attribute of a link, link so:
<a expr:href='data:label.url' expr:title='data:label.name'><data:label.name/></a>