Author Topic: [SOLVED with Custom Code] Using Gallery instead of Icon and Logo  (Read 7631 times)

0 Members and 1 Guest are viewing this topic.

Offline aboututila

Re: [SOLVED with Custom Code] Using Gallery instead of Icon and Logo
« Reply #10 on: 29. August 2009, 20:45:57 »
To see the structure of $entry,
Try putting the code
Code: [Select]
$my_module->Debug('$entry',$entry,__FILE__,__CLASS__,__LINE__);in the foreach ($entries as $entry) loop.

You should get something like;
Code: [Select]
Debug Output
File = W:\www\test1\Joomla-v1.5.x\modules\mod_sobi2simplefeatured\tmpl\default.php
Line = 36
Class =
Variable = $entry

Array
(
    [itemId] => 1
    [title] => Test’1
    [icon] => 1_ico.jpg
    [image] => 1_img.jpg
    [hits] => 109
    [fieldId1] => Street 4
    [fieldLabel1] => Street
    [fieldId2] => Postcode 1
    [fieldLabel2] => Postcode
    [fieldId3] => City 6
    [fieldLabel3] => City
    [fieldId6] => Country 1
    [fieldLabel6] => Country
    [href] => http://test1.com/index.php?option=com_sobi2&sobi2Task=sobi2Details&sobi2Id=1&Itemid=73
)

Where for;
[fieldIdx] and [fieldLabelx]
x = the ID Number of the SOBI2 Custom Field
Refer Joomla Administrator->Components->SOBI2->Configuration->Custom Fields Manager
Note: [itemId] value is NOT Joomla Itemid, it is really sobi2id value.

So to echo a specific Custom Field, you need to know it's ID number as assigned by the Custom Fields Manager.
Let us assume you want to echo the field with ID=1
then you would use the code
Code: [Select]
echo $entry['fieldId1'];
I hope this helps - Mark
Please support us by Rating and Reviewing this Module at the Joomla Extensions Directory
« Last Edit: 30. August 2009, 20:07:13 by aboututila »
Country: Honduras Honduras |  OS: Windows XP Windows XP |  Browser: Firefox 3.5.2 Firefox 3.5.2 | View Profile


Offline hifut

Re: [SOLVED with Custom Code] Using Gallery instead of Icon and Logo
« Reply #11 on: 30. August 2009, 15:17:03 »
Hi, thanks for the reply, the code didn't show though.
Country: United Kingdom United Kingdom |  OS: Windows XP Windows XP |  Browser: Firefox 3.5.2 Firefox 3.5.2 | View Profile

Offline aboututila

Re: [SOLVED with Custom Code] Using Gallery instead of Icon and Logo
« Reply #12 on: 30. August 2009, 19:54:47 »
Hi, thanks for the reply, the code didn't show though.

There seems to be a bug with this forum where it does not properly parse the BB code tags, especially if there are more than 1 set of code tags in the posting.
I have reported it, but it has not been fixed yet. Try hitting the refresh button on your browser 3 or 4 times until the code is displayed.

I have also posted it below without the BB code tags.
To see the structure of $entry,
Try putting the code
$my_module->Debug('$entry',$entry,__FILE__,__CLASS__,__LINE__);
in the foreach ($entries as $entry) loop.

You should get something like;
Debug Output
File = W:\www\test1\Joomla-v1.5.x\modules\mod_sobi2simplefeatured\tmpl\default.php
Line = 36
Class =
Variable = $entry

Array
(
    [itemId] => 1
    [title] => Test’1
    [icon] => 1_ico.jpg
    [image] => 1_img.jpg
    [hits] => 109
    [fieldId1] => Street 4
    [fieldLabel1] => Street
    [fieldId2] => Postcode 1
    [fieldLabel2] => Postcode
    [fieldId3] => City 6
    [fieldLabel3] => City
    [fieldId6] => Country 1
    [fieldLabel6] => Country
    [href] => http://test1.com/index.php?option=com_sobi2&sobi2Task=sobi2Details&sobi2Id=1&Itemid=73
)

Where for;
[fieldIdx] and [fieldLabelx]
x = the ID Number of the SOBI2 Custom Field
Refer Joomla Administrator->Components->SOBI2->Configuration->Custom Fields Manager
Note: [itemId] value is NOT Joomla Itemid, it is really sobi2id value.

So to echo a specific Custom Field, you need to know it's ID number as assigned by the Custom Fields Manager.
Let us assume you want to echo the field with ID=1
then you would use the code
echo $entry['fieldId1'];
« Last Edit: 30. August 2009, 20:08:03 by aboututila »
Country: Honduras Honduras |  OS: Windows XP Windows XP |  Browser: Firefox 3.5.2 Firefox 3.5.2 | View Profile

Offline kleddo

Re: [SOLVED with Custom Code] Using Gallery instead of Icon and Logo
« Reply #13 on: 18. October 2009, 19:52:24 »
Is anybody able to code an additional else step in the if-loop to show a default icon, if no gallery-pic has been uploaded to the entry?
I tried to do this using parts of the original code, but my php is not good enough.  :-\

My problem is the php phrase for "if no gallery-pic has been uploaded to the entry".
« Last Edit: 19. October 2009, 07:51:58 by kleddo »
Country: Germany Germany |  OS: Mac OS X 10.5 Mac OS X 10.5 |  Browser: Firefox 3.5.3 Firefox 3.5.3 | View Profile

Offline adlibitum

Re: [SOLVED with Custom Code] Using Gallery instead of Icon and Logo
« Reply #14 on: 16. September 2010, 10:58:54 »
Hi

I create 2 copies mod_sobi2simplefeatured in my site.
I would like to display gallery thumb only in one module (simple featured) and second module display without gallery thumb.
How can I recognize in code in default.php file which is a module?

I suppose that I have to use in default.php conditional IF but where and how ?

help me please

Country: Poland Poland |  OS: Windows XP Windows XP |  Browser: Firefox 3.6.9 Firefox 3.6.9 | View Profile

Offline aboututila

Re: [SOLVED with Custom Code] Using Gallery instead of Icon and Logo
« Reply #15 on: 16. September 2010, 19:33:38 »
I do not support this customization of mod_sobi2simplefeatured
But I would suggest trying to make a copy of default.php, implement the 'gallery thumb' modification and then naming the modified file to something like 'gallery.php'
Then when you configure each instance of the module you would select;
Module Parameters->Advanced Parameters->Template=default.php (for the standard module code)
and
Module Parameters->Advanced Parameters->Template=gallery.php (for the module with the customized code)

Regards - Mark
« Last Edit: 16. September 2010, 19:37:18 by aboututila »
Country: Honduras Honduras |  OS: Windows XP Windows XP |  Browser: Firefox 3.6.9 Firefox 3.6.9 | View Profile

Offline adlibitum

Re: [SOLVED with Custom Code] Using Gallery instead of Icon and Logo
« Reply #16 on: 17. September 2010, 14:22:37 »
it works perfekt !!!!

thank you very very much
you are the best :)
Country: Poland Poland |  OS: Windows XP Windows XP |  Browser: Firefox 3.6.10 Firefox 3.6.10 | View Profile

Offline ZeuS

  • Sobi Newbie
  • *
  • Posts: 5
Re: [SOLVED with Custom Code] Using Gallery instead of Icon and Logo
« Reply #17 on: 27. October 2011, 07:57:10 »
Hi fellows!

I found the new solution to the latest gallery plugin (2.56). Based on hifut and Aboututila posts.

This is the basic code you have to insert to your default php(/modules/mod_sobi2simplefeatured/tmpl/):

Search this:
Code: [Select]
# output HTML for Icon, if required
$my_module->echoHTML_Icon($entry);

# output HTML for Image, if required
$my_module->echoHTML_Image($entry);

and replace to:
Code: [Select]
$thumb_jpg="images/com_sobi2/gallery/".$entry['itemId']."/".$entry['itemId']."_thumb_1.jpg";
      $thumb_gif="images/com_sobi2/gallery/".$entry['itemId']."/".$entry['itemId']."_thumb_1.gif";
      if (file_exists("$thumb_jpg")) {
        echo "<a href='".$entry['href']."'>";
        echo "<img src=\"$thumb_jpg\" border=1 >";
        echo "</a>";
      } else {
        if (file_exists("$thumb_gif")) {
          echo "<a href='".$entry['href']."'>";
          echo "<img src=\"$thumb_gif\" border=1 >";
          echo "</a>";
        }
      }

Next one is gallery.class.php (/components/com_sobi2/plugins/gallery):
Search this code (Around 770):
Code: [Select]
$tempArray = array ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','r','s','t','u','t');
$tempStr = $tempArray[rand(0,20)].$tempArray[rand(0,20)].$tempArray[rand(0,20)];
$imageName = "{$folderId}_image_{$filePos}_{$tempStr}.{$fileExt}";
$thumbName = "{$folderId}_thumb_{$filePos}_{$tempStr}.{$fileExt}";
         
replace to:
Code: [Select]
$imageName = "{$folderId}_image_{$filePos}.{$fileExt}";
$thumbName = "{$folderId}_thumb_{$filePos}.{$fileExt}";

enjoy :)
Country: Hungary Hungary |  OS: Windows 7/Server 2008 R2 Windows 7/Server 2008 R2 |  Browser: Chrome 14.0.835.202 Chrome 14.0.835.202 | View Profile

Tags: