Please login or register.
Login with username, password and session length
June 20, 2013, 03:32:46 AM
News: We're back! And here to stay!
collapse

* User Info

 
 
Welcome, Guest. Please login or register.
Did you miss your activation email?

* Recent Posts

RS2 Gallery installed, but no component in backend by SRD
[June 15, 2013, 10:48:26 AM]


you must provide a description by kasix
[May 24, 2013, 11:48:59 PM]


Fatal error: by mailtobala04
[May 17, 2013, 04:36:20 PM]


Backend Items (Images) don't work by bauchinj
[May 15, 2013, 04:18:55 PM]


Permissions issue: a user can upload images in other user galleries by guidocx84
[May 11, 2013, 05:17:44 PM]


Payment after loggin by mirjam
[May 11, 2013, 03:02:56 PM]


image titles without dashes by mirjam
[May 11, 2013, 02:57:48 PM]


Batch Upload Fails by mirjam
[May 11, 2013, 02:52:08 PM]

Advertisement


Pages: [1]   Go Down

Author Topic: Link for Items in RSGallery2  (Read 421 times)

Offline ultramedia

  • Newbie
  • *
  • Posts: 1

Link for Items in RSGallery2
« on: June 03, 2012, 02:53:00 AM »
In the options for every item, a PARAMETERS area exists for a link and text for same. The info says that "for some templates" the links are active. I would like my template to be one of those. Can you please tell me what criteria must exist in the template (or code that is required) to have the item be actively linked to a user-definable URL?

Thank you
I'm using Joomla 1.5, and RSGallery2 2.00.0

Offline mirjam

  • Dev Team
  • Hero Member
  • *****
  • Posts: 558

Re: Link for Items in RSGallery2
« Reply #1 on: June 03, 2012, 02:18:36 PM »
The only place where I know that the Item Parameters Link and Link Text is the RSGallery2 Single Image Display plugin (http://joomlacode.org/gf/project/rsgallery2/frs/?action=FrsReleaseBrowse&frs_package_id=2994, latest version for Joomla 1.5 is plg_rsg2_singledisplay_2.1_J15). That plugin has a Parameter in its Plugin Parameters: Popup Style where with the option "Use Link and Link Text" (value: use_link) use the Item Parameters you mention. I don't know of any other templates that use these parameters, but I did not want to remove them in case anyone uses it for custom templates, or the single display plugin.

Check the rsgallery2_singledisplay.php file in that plugin on how the Link and Link Text parameters are implemented (I started from line 229: case "use_link" and went back and forth).

So the question becomes how one can use the parameters in a template. I'm using the rsgallery2_singledisplay.php file as an example how these item parameters are obtainted where $image_object is an rsgItem_image object.
Code: [Select]
$params_obj = $image_object->parameters(); //line 132
$params_obj->get( 'link', '' ) //line 157

Let's take the file /components/com_rsgallery2/templates/sementic/html/item_image.php where $this is an rsgDisplay_semantic object. This rsgDisplay_semantic object holds an rsgItem_image object (which is the $params_obj in the rsgallery2_singeldisplay.php file), and in line 4 in the file mentioned
Code: [Select]
$item = $this->currentItem;
$item now holds this rsgItem_image object. Now when you add
Code: [Select]
$params_obj = $item->parameters();
you get all the parameters and with
Code: [Select]
$link_text = $params_obj->get( 'link_text','' );
$link = $params_obj->get( 'link', '' );
you get the two parameters you want (parameters link_text and link both have here an empty string as default value when there is no value).

By the way, I use J!Dump, extensions.joomla.org/extensions/miscellaneous/development/1509, to find out what kind of "thing" $this is...

Let's add such a Link with Link Text to the item view like this one: http://demo.rsgallery2.nl/demo-rsgallery2/3-a-subgallery/23-1545499.html. For that the start of the file /components/com_rsgallery2/templates/sementic/html/item_image.php becomes
Code: [Select]
<?php
defined('_JEXEC') or die('Restricted access');

$item $this->currentItem;
$watermark $rsgConfig->get('watermark');

$imageOriginalUrl $watermark waterMarker::showMarkedImage$item->name'original' ) : imgUtils::getImgOriginal$item->name );

$imageUrl $watermark waterMarker::showMarkedImage$item->name ) : 
imgUtils::getImgDisplay$item->name );

//Get parameters of item object (e.g. Link and Link Text)
$params_obj $item->parameters();
//Get the specific link_text and link parameters
$link_text $params_obj->get'link_text','' );
$link $params_obj->get'link''' );
//Do something with these parameters
$output '<a href="' $link '">';
$output .= $params_obj->get'link_text','' ); 
$output .= '</a>';
echo $output;

switch ($rsgConfig->get('displayPopup')) {
//No popup
With the added code a link is added next to the image (make sure you have entered Link and Link Text for the image you're viewing!).

I hope this is enough info to get you started to implement a link where you want it... I used RSGallery2 2.2.1 for this (it has several bug fixes over 2.00.0 which is quite old).

Perhaps this link, http://www.rsgallery2.nl/display_and_templates/how_create_your_own_template_or_modify_semantic_template_16758.0.html, helps you as well to create your own template based on the Semantic template.
Suddenly on maternity leave: our baby boy was born a few weeks early, he's doing well now.
For the next couple of weeks I won't available, for true emergences pm locutusweb please.

I hope that RSGallery2 users will help each other out in the mean time.
Pages: [1]   Go Up
 

anything