This topic contains a post which is marked as Best Answer. Press here if you would like to see it.
*

votresiteweb

  • ***
  • 45 posts
Open a URL link in custom field in a new window
« on: May 06, 2017, 10:26:07 PM »
Hello how to open the url link that is in "custom field" in a new window

*

Ivanko

  • *****
  • 388 posts
Re: Open a URL link in custom field in a new window
« Reply #1 on: May 06, 2017, 11:26:24 PM »
It this url under :
LISTING -》CUSTOM FIELDS ?

*

votresiteweb

  • ***
  • 45 posts
Re: Open a URL link in custom field in a new window
« Reply #2 on: May 06, 2017, 11:40:02 PM »
Hi Ivanko,

Yes exactly :)
When I create a custom field in URL it does not open in a new window.

How to change this?

Thank you :)  ;) :D

*

Ivanko

  • *****
  • 388 posts
Re: Open a URL link in custom field in a new window
« Reply #3 on: May 07, 2017, 12:32:21 AM »
Then you need to modify core.
In /oc-includes/osclass/helpers/hItems.php

below:
Code: [Select]
/***************
* META FIELDS *
***************/

find:
Code: [Select]
                if(stripos(osc_field(osc_item_meta(), 's_value', ''),'http://')!==false || stripos(osc_field(osc_item_meta(), 's_value', ''),'https://')!==false) {
                    return '<a href="'.html_entity_decode(osc_field(osc_item_meta(), 's_value', ''), ENT_COMPAT, "UTF-8").'" >'.html_entity_decode(osc_field(osc_item_meta(), 's_value', ''), ENT_COMPAT, "UTF-8").'</a>';
                } else {
                    return '<a href="http://'.html_entity_decode(osc_field(osc_item_meta(), 's_value', ''), ENT_COMPAT, "UTF-8").'" >'.html_entity_decode(osc_field(osc_item_meta(), 's_value', ''), ENT_COMPAT, "UTF-8").'</a>';

replace with:
                 
Code: [Select]
if(stripos(osc_field(osc_item_meta(), 's_value', ''),'http://')!==false || stripos(osc_field(osc_item_meta(), 's_value', ''),'https://')!==false) {
                    return '<a href="'.html_entity_decode(osc_field(osc_item_meta(), 's_value', ''), ENT_COMPAT, "UTF-8").'"target="_blank" >'.html_entity_decode(osc_field(osc_item_meta(), 's_value', ''), ENT_COMPAT, "UTF-8").'</a>';
                } else {
                    return '<a href="http://'.html_entity_decode(osc_field(osc_item_meta(), 's_value', ''), ENT_COMPAT, "UTF-8").'"target="_blank" >'.html_entity_decode(osc_field(osc_item_meta(), 's_value', ''), ENT_COMPAT, "UTF-8").'</a>';


« Last Edit: May 07, 2017, 07:44:02 AM by Ivanko »

*

votresiteweb

  • ***
  • 45 posts
Re: Open a URL link in custom field in a new window
« Reply #4 on: May 07, 2017, 01:01:57 AM »
Hi Ivanko,

Thank you very much for your assistance, but the code not work  :'( :'( :'( :'( :'(
The site no longer works when I change this line

the code don't work is it possible to check that please :)

 ;)

*

Ivanko

  • *****
  • 388 posts
Re: Open a URL link in custom field in a new window
« Reply #5 on: May 07, 2017, 01:16:50 AM »
Try one more time now

*

votresiteweb

  • ***
  • 45 posts
Re: Open a URL link in custom field in a new window
« Reply #6 on: May 07, 2017, 07:19:38 AM »
Thank you Ivanko but :'( :'( :'( :'( :'( :'( that's don't work  :'( :'( :'( :'(

*

Ivanko

  • *****
  • 388 posts
Re: Open a URL link in custom field in a new window
« Reply #7 on: May 07, 2017, 07:24:44 AM »
There was unnecessary extra space.
Try again, I corrected.
replace exactly only those lines.

« Last Edit: May 07, 2017, 08:14:25 AM by Ivanko »

*

votresiteweb

  • ***
  • 45 posts
Re: Open a URL link in custom field in a new window
« Reply #8 on: May 07, 2017, 09:48:51 AM »
 :'( :'( :'( :'( :'( :'( :'( :'( that's don't work my friend  :'( :'( :'( :'( :'( :'( :'( :'(
I did well as requested  :'( :'( :'( :'( :'( :'( :'( :'(

Marked as best answer by votresiteweb on May 07, 2017, 01:14:21 PM
*

Ivanko

  • *****
  • 388 posts
Re: Open a URL link in custom field in a new window
« Reply #9 on: May 07, 2017, 10:00:49 AM »
you just need to ad " target="_blank" in two places


where you have:
ENT_COMPAT, "UTF-8").'" >


change with:
ENT_COMPAT, "UTF-8").'" target="_blank">

*

votresiteweb

  • ***
  • 45 posts
Re: Open a URL link in custom field in a new window
« Reply #10 on: May 07, 2017, 01:15:02 PM »
Hi my friend, perfect that's work  ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D

*

MB Themes

Re: Open a URL link in custom field in a new window
« Reply #11 on: November 19, 2024, 08:14:57 PM »
in config.php, change base url to https://
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots