Author Topic: New Module "OneForAll"  (Read 45460 times)

Offline jacobi22

  • Posts: 5836
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: New Module "OneForAll"
« Reply #275 on: October 28, 2017, 04:21:43 PM »
New Version of OneForAll:

VERSION 1.0.9 (10/28/2017)


PLEASE NOTE:
Upgrade recommended for WB 2.10.x- Users and necessary, if server runs in MYSQL-STRICT-MODE



VERSION HISTORY
Thanks to dbs for reporting and tests
   + fix for mysql-strict-mode in add_item.php, save_item.php, save_fields.php, upgrade.php
   + fix language variables problem in mode "edit css"
   + replace old, deprecated languages variables in multiple files
   + remove changelog from info.php, because, there is a char limiter to read the infos


KNOW HOW
Further information can be found on the first post of this thread.

DOWNLOAD
Download the zip from this download link.


Uwe (jacobi22)
Probleme sind da, um sie zu lösen, nicht, um nach Ausreden zu suchen.

Offline Boudi

  • Global Moderator
  • *****
  • Posts: 1190
  • Gender: Male
  • //o_-\\
    • Yze Webdesign
Re: New Module "OneForAll"
« Reply #276 on: February 04, 2018, 10:33:35 PM »
Hi,

For the first time I'm trying out the oneforall_allitems snippet. So far so good... it's working.

Next step was extending the snippet with [THUMB] and [FIELD_1]  fields.

So in the include.php  I changed the:

Code: [Select]
$setting_item_loop = '
<li><a href="[LINK]" title="[TITLE]" target="_blank">[TITLE]</a></li>';

into:
Code: [Select]
$setting_item_loop = '
<li><a href="[LINK]" title="[TITLE]" target="_blank">[TITLE]</a>
<div class="img-allitems" style="max-width: 100%">
[THUMB]
</div>
[FIELD_1]
</li>';

Result:

My new Product (correct link + title, same as on the ofa page)
[THUMB]
[FIELD_1]

So in short: the [THUMB] and [FIELD_1] aren't working.

What am I doing wrong?

Regards,

Boudi
...:: Bake the Unbakable ::...

Offline dbs

  • Betatester
  • **
  • Posts: 7907
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: New Module "OneForAll"
« Reply #277 on: February 05, 2018, 08:24:28 AM »
Hi, in include.php line 121 afterwards are only title and link defined.
You have to add what you want.

Example, added modified_when:
Code: [Select]
<?php // colored
// Query items
$query_items $database->query("SELECT page_id, title, link, modified_when FROM ".TABLE_PREFIX."mod_".$mod_name."_items WHERE active = '1' AND title != '' ORDER BY position ASC".$limit_sql);

// Loop through all items of this module
if ($query_items->numRows() > 0) {
while ($item $query_items->fetchRow()) {
$page_id stripslashes($item['page_id']);
$title   htmlspecialchars(stripslashes($item['title']));
$datum   date('d.m.Y',$item['modified_when']);
// Work-out the item link
$item_link WB_URL.PAGES_DIRECTORY.get_page_link($page_id).$item['link'].PAGE_EXTENSION;

// Replace placeholders by values
// Make array of placeholders
$placeholders = array('[TITLE]''[LINK]''[DATUM]');
// Make array of values
$values = array($title$item_link$datum);
// HTML of item loop
$html .= str_replace($placeholders$values$setting_item_loop);
}
}

Offline Boudi

  • Global Moderator
  • *****
  • Posts: 1190
  • Gender: Male
  • //o_-\\
    • Yze Webdesign
Re: New Module "OneForAll"
« Reply #278 on: February 05, 2018, 09:34:21 AM »
Hi,

Thnq for your answer. I got the standard (meta) Description field visible now. But that's not what I want. I need custom content to be visible and also the thumb image.

These variables I can't find back in the db as seperate fields. Or do I have to create a second rule with the page_settings? E.g.

Code: [Select]
$query_items = $database->query("SELECT item_loop FROM ".TABLE_PREFIX."mod_".$mod_name."_page_settings WHERE active = '1' AND title != '' ORDER BY position ASC".$limit_sql);
...:: Bake the Unbakable ::...

Offline Ruud

  • Posts: 3649
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: New Module "OneForAll"
« Reply #279 on: February 05, 2018, 09:35:25 AM »
Don't use ofa_allitems, use ofa_anyitems instead.
That one will display all content, where allitems is only for title+link.

https://addon.WebsiteBaker.org/pages/en/browse-add-ons.php?id=0C342392

Offline Boudi

  • Global Moderator
  • *****
  • Posts: 1190
  • Gender: Male
  • //o_-\\
    • Yze Webdesign
Re: New Module "OneForAll"
« Reply #280 on: February 05, 2018, 10:16:15 AM »
Yes! Working now. (Y)

Thanks guys!

Rgdz,
...:: Bake the Unbakable ::...

Online CodeALot

  • Posts: 418
  • Gender: Male
Re: New Module "OneForAll" - Dayname in date?
« Reply #281 on: March 28, 2018, 02:35:38 PM »
In a field of type "DateTime Select" I want the module not to just show 28-03-2018 at 13.00 but I want it to say Wednesday 28-03-2018 at 13.00.
Should this be done when saving the item or can it be done 'on the fly' when reading the data from the database?

Offline Boudi

  • Global Moderator
  • *****
  • Posts: 1190
  • Gender: Male
  • //o_-\\
    • Yze Webdesign
Re: New Module "OneForAll"
« Reply #282 on: October 03, 2018, 11:05:47 AM »
Hi,

Short question:

How can i make the overview items random? (even with multiple pages).

Hope for an answer.

Kind regards,

Boudi
« Last Edit: October 04, 2018, 04:41:26 PM by Boudi »
...:: Bake the Unbakable ::...

Offline dbs

  • Betatester
  • **
  • Posts: 7907
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: New Module "OneForAll"
« Reply #283 on: October 03, 2018, 05:40:13 PM »
Hi, you want with every page load a different order in frontend?
You mean not the snippet all_items?

In view_overview.php line 101 of the latest OFA try RAND()
change this
Code: [Select]
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'mod_'.$mod_name.'_items` WHERE `section_id` = '.$section_id.' AND `active` = 1 AND `title` != \'\' ORDER BY `position` '.$position_order.$limit_sql;to this
Code: [Select]
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'mod_'.$mod_name.'_items` WHERE `section_id` = '.$section_id.' AND `active` = 1 AND `title` != \'\' ORDER BY RAND() ';
If you have groups this will not work. Would be another line.

Offline Boudi

  • Global Moderator
  • *****
  • Posts: 1190
  • Gender: Male
  • //o_-\\
    • Yze Webdesign
Re: New Module "OneForAll"
« Reply #284 on: October 04, 2018, 10:30:44 AM »
Hi DBS,

Thank you. It worked...partially. I was this far too. The problem that we get after this edit is that ALL the overview items are placed in one page.

I have 6 overview items per page and I have 5 pages. So 30 items in total.

What I would like is a random view like now but then the structure with 6 items per page.
...:: Bake the Unbakable ::...

Offline dbs

  • Betatester
  • **
  • Posts: 7907
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: New Module "OneForAll"
« Reply #285 on: October 04, 2018, 04:25:22 PM »
"We" have forgotten the limit  $limit_sql .Try this:
Code: [Select]
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'mod_'.$mod_name.'_items` WHERE `section_id` = '.$section_id.' AND `active` = 1 AND `title` != \'\' ORDER BY RAND() '.$limit_sql;

Offline Boudi

  • Global Moderator
  • *****
  • Posts: 1190
  • Gender: Male
  • //o_-\\
    • Yze Webdesign
Re: New Module "OneForAll"
« Reply #286 on: October 04, 2018, 04:50:18 PM »
Thank you. It's working partially. Problem is that on every page you get the same random. So it possible that you see the same items on every page then.

Final solution is a rewrite of some codes. Or create one page with lazyload or something.

...:: Bake the Unbakable ::...

Offline dbs

  • Betatester
  • **
  • Posts: 7907
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: New Module "OneForAll"
« Reply #287 on: October 04, 2018, 05:05:05 PM »
Had 8 items in 3 groups. Needs a change some lines above. This had worked.
I should try without groups.

But the better way is the snippet any_items with some changes (like more sort orders).

 

postern-length