Author Topic: New URL type - Displays in Current Web Site Window  (Read 5130 times)

0 Members and 1 Guest are viewing this topic.

Offline aboututila

New URL type - Displays in Current Web Site Window
« on: 20. August 2007, 22:34:41 »
Posted here as a suggested New Feature/enhancement to SOBI2

Problem: The existing URL type of "http" opens the link in a new browser window.
There may be time when you want to display information in the same window of the current web site and not open a new window.

Solution: Add a new URL type (which I have arbitrarily named "anchor") which displays the URL results in the current window.
This is a quick hack, which doesn't use Language files (my web site is in English).

Method:
(1) In the file \administrator\components\com_sobi2\admin.field.class.php
    Find the line (around line 379)
    $urlTypes[]    = mosHTML::makeOption( '4', _SOBI2_FIELD_VIDEO);
   
    Below the line;
    $urlTypes[]    = mosHTML::makeOption( '4', _SOBI2_FIELD_VIDEO);
    Add the line;
    $urlTypes[]    = mosHTML::makeOption( '5', 'anchor');

(2) In the file \components\com_sobi2\sobi2.php

    Find the lines (around line 817 and line 942)
    else if($field->isUrl == 3)

    below this "else if" statement, and another "else if" statement
    else if($field->isUrl == 5) {$data = "<a href='{$field->data}'>{$field->label}</a>";}

(3) In the file \components\com_sobi2\sobi2.class.php

    Find the lines (around line 810)
    /* url processing */
    if(( $field->isUrl == 1 || $field->isUrl == 3 || $field->isUrl == 4)

    change the string to
    if(( $field->isUrl == 1 || $field->isUrl == 3 || $field->isUrl == 4 || $field->isUrl == 5)

(4) In the file \components\com_sobi2\frontend.class.php

    Find the lines (around line 426 and line 683)
    else if($field->isUrl == 3)

    below this "else if" statement, add another "else if" statement
    else if($field->isUrl == 5) {$data = "<a href='{$field->data}'>{$field->label}</a>";

Regards - Mark
Country: Honduras Honduras |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile


Offline Leonie

Re: New URL type - Displays in Current Web Site Window
« Reply #1 on: 21. March 2008, 10:06:32 »
I very much would like to make this hack, because I want the URL type to use for internal links. But in my version of SOBI 2 (RC 2.8.4) nothing is like you discribe.
Please help.
Country: Netherlands Netherlands |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Do you want continued ongoing development, new features and active support?
Please write a review or just vote for SOBI on JED.

Offline aboututila

Re: New URL type - Displays in Current Web Site Window
« Reply #2 on: 21. March 2008, 15:44:57 »
Leonie,

The above was written for SOBI2 v2.7.3.
I am sorry, but I have not had the opportunity to re-visit the hack (or even establish if it is still necessary) for SOBI2 v2.8.4

Regards - Mark
Country: Honduras Honduras |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Tags: