*

bkfly1

  • **
  • 24 posts
Custom Field type URL
« on: October 31, 2022, 09:53:22 PM »
I have my OSClass page embedded in my website using an Embed tag.  This allows me to present the OSClass content within my custom header / footer to match the rest of my site and is working well. 

In OSClass, I added a custom field named "website" with the type "URL" to allow people posting items to include the URL of the provider.  Works fine, except it launches this external sites' page within my header/footer as well.  I was hoping to modify the OSClass code to customize the target attribute so it launches this linked page in a new browser tab, but can't seem to locate where this is configured.  Anyone know where this can be modified?

*

MB Themes

Re: Custom Field type URL
« Reply #1 on: November 02, 2022, 08:18:12 AM »
oc-includes/osclass/helpers/hItems.php

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

You should probably add target="_top" to both link variants.

Code: [Select]
      if(stripos($value,'http://')!==false || stripos($value,'https://')!==false) {
        return '<a target="_top" href="'.osc_esc_html(html_entity_decode($value, ENT_COMPAT, "UTF-8")).'" >'.osc_esc_html(html_entity_decode($value, ENT_COMPAT, "UTF-8")).'</a>';
      } else {
        return '<a target="_top" href="http://'.osc_esc_html(html_entity_decode($value, ENT_COMPAT, "UTF-8")).'" >'.osc_esc_html(html_entity_decode($value, ENT_COMPAT, "UTF-8")).'</a>';
      }
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

bkfly1

  • **
  • 24 posts
Re: Custom Field type URL
« Reply #2 on: November 02, 2022, 02:40:06 PM »
That worked!  Thanks for the guidance.  I doubt I would have found that on my own.