- Posts: 15920
COMMUNITY FORUM
How to strip tags in Module K2 comments
- Suba
- Topic Author
- Visitor
11 years 4 months ago #113165
by Suba
How to strip tags in Module K2 comments was created by Suba
I have created a latest comment module with Module K2 comments. Is there an option to prevent it from parsing html in the module? I don't want the links to be clickable in the module, all should appear as plain text.
Please Log in or Create an account to join the conversation.
- Yiota
- Visitor
11 years 4 months ago #113166
by Yiota
Replied by Yiota on topic Re: How to strip tags in Module K2 comments
You could make a template override for the module and comment out the link part.
Please Log in or Create an account to join the conversation.
- Suba
- Topic Author
- Visitor
11 years 4 months ago #113167
by Suba
I tried to add strip_tags() to $comment->commenText, but that didn't work.
Replied by Suba on topic Re: How to strip tags in Module K2 comments
What should I edit?Yiota Ziaggou wrote: You could make a template override for the module and comment out the link part.
I tried to add strip_tags() to $comment->commenText, but that didn't work.
<?php if($params->get('commentLink')): ?>
<a href="<?php echo $comment->link; ?>"><span class="lcComment"><?php echo $comment->commentText; ?></span></a>
<?php else: ?>
<span class="lcComment"><?php echo $comment->commentText; ?></span>
<?php endif; ?>
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
11 years 4 months ago #113168
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Re: How to strip tags in Module K2 comments
Did you strip tags for both instances?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Suba
- Topic Author
- Visitor
11 years 4 months ago #113169
by Suba
Replied by Suba on topic Re: How to strip tags in Module K2 comments
Yes.
I have confirmed that the template overriding is working by putting some string inside <span class="lsComment"></span>
<?php if($params->get('commentLink')): ?>
<a href="<?php echo $comment->link; ?>"><span class="lcComment"><?php echo strip_tags($comment->commentText); ?></span></a>
<?php else: ?>
<span class="lcComment"><?php echo strip_tags($comment->commentText); ?></span>
<?php endif; ?>
I have confirmed that the template overriding is working by putting some string inside <span class="lsComment"></span>
Please Log in or Create an account to join the conversation.
- Suba
- Topic Author
- Visitor
11 years 4 months ago #113170
by Suba
Replied by Suba on topic Re: How to strip tags in Module K2 comments
Bump
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
11 years 4 months ago #113171
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Re: How to strip tags in Module K2 comments
strip_tags() Will kill all of your HTML code, if your comment has any HTML code which I think K2 is only allowing basic tags.
If you want to remove allthe links you have to remove all the <a> elements eg. you have to remove this completely
<a href="<?php echo $comment->link; ?>"><span class="lcComment"><?php echo $comment->commentText; ?></span></a>
<?php else: ?>
If you want to remove allthe links you have to remove all the <a> elements eg. you have to remove this completely
<a href="<?php echo $comment->link; ?>"><span class="lcComment"><?php echo $comment->commentText; ?></span></a>
<?php else: ?>
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.