- Posts: 68
COMMUNITY FORUM
Forbid links in commens?
- web_dev
- Topic Author
- Offline
- Senior Member
Less
More
10 years 2 months ago #130586
by web_dev
Forbid links in commens? was created by web_dev
It's possible to forbid links in comment form?
Please Log in or Create an account to join the conversation.
- Lefteris
- Offline
- Moderator
Less
More
- Posts: 8743
10 years 2 months ago #130587
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic Re: Forbid links in commens?
Hi. Do you want to hide the URL field or strip links from the comments text?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- web_dev
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 68
10 years 2 months ago #130588
by web_dev
Replied by web_dev on topic Re: Forbid links in commens?
Hi,
i want to strip links from the comments text
i want to strip links from the comments text
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 2 months ago #130589
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Re: Forbid links in commens?
You can use strip_tags:
php.net/manual/en/function.strip-tags.php
eg:
The code for the comments list is located in the item.php file.
php.net/manual/en/function.strip-tags.php
eg:
<?php echo strip_tags($comment->commentText); ?>
The code for the comments list is located in the item.php file.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- BrethrenArchives.Com
- Offline
- Junior Member
Less
More
- Posts: 37
9 years 11 months ago - 9 years 11 months ago #130590
by BrethrenArchives.Com
Replied by BrethrenArchives.Com on topic Re: Forbid links in commens?
Krikor,
Thank you commenting on this topic. Here is a link to a comment on my site. Am I also seeing that the HTML on this page will disappear?
Where do I find the item.php file please?
Cordially,
A. Wayne Webb
Thank you commenting on this topic. Here is a link to a comment on my site. Am I also seeing that the HTML on this page will disappear?
Where do I find the item.php file please?
Cordially,
A. Wayne Webb
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 11 months ago #130591
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Re: Forbid links in commens?
I get a 403 - not permitted error when I try to access these links.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Joe Campbell
- Offline
- Platinum Member
Less
More
- Posts: 438
9 years 4 months ago #143979
by Joe Campbell
Replied by Joe Campbell on topic Forbid links in commens?
Can I use the strip_tags function on Extra Fields?
I tried using the following code, but it did not convert the special characters to HTML entities:
Note: Current PHP version: 5.3.29
I tried using the following code, but it did not convert the special characters to HTML entities:
<?php echo strip_tags($this->item->extraFields->NAME->value); ?>
Note: Current PHP version: 5.3.29
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 4 months ago #143988
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Forbid links in commens?
You can also specify which tags are allowed in the funtion's params.
php.net/strip_tags
You can also use srt_replace php.net/str_replace
So you can add rel="nofollow" if you do not want to remove the links.
php.net/strip_tags
You can also use srt_replace php.net/str_replace
So you can add rel="nofollow" if you do not want to remove the links.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Joe Campbell
- Offline
- Platinum Member
Less
More
- Posts: 438
9 years 4 months ago #143994
by Joe Campbell
Replied by Joe Campbell on topic Forbid links in commens?
I am not looking to accomplish anything with comments. I merely replied to this thread because it was the only post that mentioned tag stripping.
My goal is to echo Extra Fields for meta purposes, which would require the removal of special characters especially quotes and apostrophes.
I thought I could use the existing strip_tags function, but it is not working in my item template override.
Can you please provide the specific code needed to accomplish tag stripping of an Extra Field. Thanks :)
My goal is to echo Extra Fields for meta purposes, which would require the removal of special characters especially quotes and apostrophes.
I thought I could use the existing strip_tags function, but it is not working in my item template override.
Can you please provide the specific code needed to accomplish tag stripping of an Extra Field. Thanks :)
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
9 years 4 months ago - 9 years 4 months ago #143995
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Forbid links in commens?
Sorry I misread the question.
Yes you can strip tags in an extrafield.
Strip_tags will remove (as delete) all your HTML tags (not strings).
If you want to convert it to entities, you need to use another PHP function - htmlentities php.net/htmlentities
Finally this function won't probably help you since what you need is a string replacer.
This is what you should use -> php.net/str_replace
Check the "Example #1 Basic str_replace() examples" section which is exactly what you need.
It will remove every character you do not need.
This method can be used in pretty much all text-related elements of K2.
Yes you can strip tags in an extrafield.
Strip_tags will remove (as delete) all your HTML tags (not strings).
If you want to convert it to entities, you need to use another PHP function - htmlentities php.net/htmlentities
Finally this function won't probably help you since what you need is a string replacer.
This is what you should use -> php.net/str_replace
Check the "Example #1 Basic str_replace() examples" section which is exactly what you need.
It will remove every character you do not need.
This method can be used in pretty much all text-related elements of K2.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Last edit: 9 years 4 months ago by Krikor Boghossian.
Please Log in or Create an account to join the conversation.