Author Topic: [SOLVED] Do not display Entries which do not have an Icon  (Read 2214 times)

0 Members and 1 Guest are viewing this topic.

Offline designerpro27

[SOLVED] Do not display Entries which do not have an Icon
« on: 16. August 2010, 07:27:30 »
[SOLVED - See solution]
Hello,

I want to disable entries which do not have logo.
 because I wnat to make gallery of logos of entries so, I do not want to display entries wich do not have logo.
is that possible.
thank you
« Last Edit: 07. February 2011, 18:08:14 by aboututila »
Country: Syrian Arab Republic Syrian Arab Republic |  OS: Windows XP Windows XP |  Browser: MS Internet Explorer 8.0 MS Internet Explorer 8.0 | View Profile


Offline aboututila

Re: display entries which have logo
« Reply #1 on: 16. August 2010, 21:38:07 »
designerpro27,

I am sorry, but what you require (disable entries which do not have logo) is not possible in mod_sobi2simplefeatured v2.0.6

Are you aware that SOBI2 can display a default icon and/or image for SOBI2 Entries that do not have a icon or image?
See Configuration File / Registry Editor - Default icon and logo
Many SOBI2 users use this capability to display 'No Icon' and/or 'No Image' images for those SOBI2 Entries that do not have a icon or image.

mod_sobi2simplefeatured v2.0.6 requires a workaround to display the Default icon and logo, see [CONFIRMED] Default Image or Icon not displayed for Selected Entries

Regards - Mark
Country: Honduras Honduras |  OS: Windows XP Windows XP |  Browser: Firefox 3.6.8 Firefox 3.6.8 | View Profile

Offline netzwart

  • Gold Sponsor
  • Sobi Profi
  • *
  • Posts: 276
Re: display entries which have logo
« Reply #2 on: 01. October 2010, 13:16:02 »
Are you aware that SOBI2 can display a default icon and/or image for SOBI2 Entries that do not have a icon or image?
See Configuration File / Registry Editor - Default icon and logo
Many SOBI2 users use this capability to display 'No Icon' and/or 'No Image' images for those SOBI2 Entries that do not have a icon or image.

Hello Mark,

thank you for this great module! However, i also need the feature, in that only SOBI2 Entries that have an icon or image are selected to be displayed in the module. What about this solution:

[attach=1]

The Custom field could be the "icon upload field" and the question, if there is a value in this field, could be answered with a further option. i.e. "YES".

But I think, it is not as easy as described ...  ;)

Greetings

Netzwart



Sobi2 v.2.9.3.1 - Joomla 1.5.22 - PHP 5.3 - MySQL - Windows XP
Country: Germany Germany |  OS: Windows XP Windows XP |  Browser: Firefox 3.5.13 Firefox 3.5.13 | View Profile

Offline aboututila

Re: display entries which have logo
« Reply #3 on: 02. October 2010, 23:00:27 »
Netzwart,

If you made a custom field of type=Checkbox (and assuming it had a field name of field_icon), then;
if you configured
Select Entries where Custom Field = field_icon
contains a value = Equal to
the value = 0
then every SOBI2 Entry where the Custom Field (field_icon) was NOT checked would be selected

if you configured
Select Entries where Custom Field = field_icon
contains a value = Equal to
the value = 1
then every SOBI2 Entry where the Custom Field (field_icon) WAS checked would be selected

However you would have to rely on data entry in the SOBI2 Add/Edit Entry Form correctly checking or not checking this field_icon checkbox

Regards - Mark
Country: Honduras Honduras |  OS: Windows XP Windows XP |  Browser: Firefox 3.6.10 Firefox 3.6.10 | View Profile

Offline netzwart

  • Gold Sponsor
  • Sobi Profi
  • *
  • Posts: 276
Re: display entries which have logo
« Reply #4 on: 02. October 2010, 23:14:37 »
Netzwart,

If you made a custom field of type=Checkbox (and assuming it had a field name of field_icon), then;
if you configured
Select Entries where Custom Field = field_icon
contains a value = Equal to
the value = 0
then every SOBI2 Entry where the Custom Field (field_icon) was NOT checked would be selected

if you configured
Select Entries where Custom Field = field_icon
contains a value = Equal to
the value = 1
then every SOBI2 Entry where the Custom Field (field_icon) WAS checked would be selected

However you would have to rely on data entry in the SOBI2 Add/Edit Entry Form correctly checking or not checking this field_icon checkbox

Regards - Mark

Hello Marc,

thank you for your reply. In the meantime i have decided to make a custom field, which is hidden and could only be changed by the administrator. Due to the fact, that our administrator has to check the entries before they are published, he could also choose the corresponding value for the hidden field, if the entry contains a logo. Not quite elegant, but it should work ...

Greetings

Netzwart
« Last Edit: 05. February 2011, 01:55:20 by netzwart »
Sobi2 v.2.9.3.1 - Joomla 1.5.22 - PHP 5.3 - MySQL - Windows XP
Country: Germany Germany |  OS: Windows XP Windows XP |  Browser: Firefox 3.5.5 Firefox 3.5.5 | View Profile

Offline netzwart

  • Gold Sponsor
  • Sobi Profi
  • *
  • Posts: 276
Re: display entries which have logo
« Reply #5 on: 05. February 2011, 14:15:27 »
Hi Mark,

it´s me again  ;). Is it possible, to change the core files of your module, to achive that only icons of entries with icons are shown ? This change in the core files could for example relate to the part of the code, in which the field (defined in the backend of your module) is checked.

Instead, the field and the condition could be defined in the core file (i guess it is helper.php), so that the settings in the backend of the module are no longer effective. The field and the condition could look like this (this is a code i use in vcard-template):

    <?php if( !$mySobi->icon == "" ) {
     echo $ico;
     } ?>


I am aware of the fact, that the shown code could not be included as it is, i am just using it here to show what i mean.

Do you think, this is possible? If YES, could you give me a hint how and where to change the code?

Thank you

Netzwart
« Last Edit: 05. February 2011, 14:18:22 by netzwart »
Sobi2 v.2.9.3.1 - Joomla 1.5.22 - PHP 5.3 - MySQL - Windows XP
Country: Germany Germany |  OS: Windows Vista/Server 2008 Windows Vista/Server 2008 |  Browser: Firefox 3.6.13 Firefox 3.6.13 | View Profile

Offline aboututila

Re: Do not display Entries which do not have an Icon
« Reply #6 on: 05. February 2011, 20:56:25 »
Update - An improved solution is posted here.

You could try changing the PHP code in .../modules/mod_sobi2simplefeatured/tmpl/default.php
from
Code: [Select]
# Output HTML for each Entry
foreach ($entries as $entry){
# output HTML for Entry wrapper start division
$my_module->echoHTML_Entry_Wrapper_Start();

# output HTML for Title, if required
$my_module->echoHTML_Title($entry);

# output HTML for Icon, if required
$my_module->echoHTML_Icon($entry);

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

# output HTML for Custom Fields, if required
$my_module->echoHTML_CustomFields($entry);

# output HTML for Hits Counter, if required
$my_module->echoHTML_HitsCounter($entry);

# output HTML for Text Link to Entry Details, if required
$my_module->echoHTML_TextLink($entry);

# output HTML for Entry wrapper end division
$my_module->echoHTML_Entry_Wrapper_End();

# End Output HTML for each Entry
}
to
Code: [Select]
# Output HTML for each Entry
foreach ($entries as $entry){
if ($entry['icon']){
# the Entry has an icon, so display the Entry
# output HTML for Entry wrapper start division
$my_module->echoHTML_Entry_Wrapper_Start();

# output HTML for Title, if required
$my_module->echoHTML_Title($entry);

# output HTML for Icon, if required
$my_module->echoHTML_Icon($entry);

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

# output HTML for Custom Fields, if required
$my_module->echoHTML_CustomFields($entry);

# output HTML for Hits Counter, if required
$my_module->echoHTML_HitsCounter($entry);

# output HTML for Text Link to Entry Details, if required
$my_module->echoHTML_TextLink($entry);

# output HTML for Entry wrapper end division
$my_module->echoHTML_Entry_Wrapper_End();

# End Output HTML for each Entry
}
}

Regards - Mark
« Last Edit: 08. March 2011, 19:44:15 by aboututila »
Country: Honduras Honduras |  OS: Windows XP Windows XP |  Browser: Firefox 3.6.13 Firefox 3.6.13 | View Profile

Offline netzwart

  • Gold Sponsor
  • Sobi Profi
  • *
  • Posts: 276
Re: display entries which have logo
« Reply #7 on: 07. February 2011, 14:03:17 »
Hi Mark,

this works perfect! Even the settings in the backend (custom field and its predefined value) still work!

Thank you very much

Netzwart  :D
Sobi2 v.2.9.3.1 - Joomla 1.5.22 - PHP 5.3 - MySQL - Windows XP
Country: Germany Germany |  OS: Windows XP Windows XP |  Browser: Firefox 3.5.5 Firefox 3.5.5 | View Profile

Offline aboututila

Re: [SOLVED] Do not display Entries which do not have an Icon
« Reply #8 on: 08. February 2011, 22:21:37 »
The previous solution may cause problems with regard to Output Controls - Limit and Filters > Limit = X
since it is possible that some of those selected X Entries may not have an Icon value, then
the previous solution would not display those Entries that did not have an Icon, AND therefore it was possible for the module to output less than Limit = X Entries.

For example, if Limit = 10, and ten Entries were selected, BUT two of those ten Entries did not have an Icon value, then only eight (10 - 2) Entries would be displayed.

An alternative solution which acts like a 'Only Select Entries with an Icon' Filter is;
Edit the file
.../modules/mod_sobi2simplefeatured/helper.php
around line 245
after line
$conditions.=' AND (item.'.$db->nameQuote('published').'='.$db->quote('1').' AND item.'.$db->nameQuote('approved').'='.$db->quote('1').' AND (item.'.$db->nameQuote('publish_down').'>'.$db->quote(date('y-m-d h:i:s')).' OR item.'.$db->nameQuote('publish_down').'='.$db->quote('0000-00-00 00:00:00').'))';

add the lines
# My hack to the standard module code to also only select those Entries which have an Icon Value
$conditions.=' AND (item.'.$db->nameQuote('icon').' IS NOT NULL';

This will cause the module to conform to all configurable Entry Selection Criteria, but also only select those Entries that have an Icon Value (jos_sobi2_item.icon IS NOT NULL)

Regards - Mark
« Last Edit: 08. February 2011, 22:28:14 by aboututila »
Country: Honduras Honduras |  OS: Windows XP Windows XP |  Browser: Firefox 3.6.13 Firefox 3.6.13 | View Profile

Offline netzwart

  • Gold Sponsor
  • Sobi Profi
  • *
  • Posts: 276
Re: [SOLVED] Do not display Entries which do not have an Icon
« Reply #9 on: 09. February 2011, 09:05:34 »
Hi Mark,

thank your for the hack, however, it still does not work:

First of all, it should be mentioned, that there is missing one of the right parentheses in your hack (red):

$conditions.=' AND (item.'.$db->nameQuote('icon').' IS NOT NULL)';

But even if i fix it, the result is not as expected, i. e. the entry WITHOUT AN ICON is still selected and "shown" (see screenshot).

I think that we are close to a solution. Any idea how to solve this problem?

Thank you in advance

Netzwart
« Last Edit: 09. February 2011, 22:50:13 by netzwart »
Sobi2 v.2.9.3.1 - Joomla 1.5.22 - PHP 5.3 - MySQL - Windows XP
Country: Germany Germany |  OS: Windows XP Windows XP |  Browser: Firefox 3.5.5 Firefox 3.5.5 | View Profile

Tags: