WBCE CMS Forum

WBCE CMS – Way Better Content Editing.

You are not logged in.

#1 10.09.2021 02:27:30

losttrip
Member

NWI Import of Settings ONLY

I'm working on a site with a LOT of News with Images (NWI) sections.  I want them to all have the same Page Settings.  I know when I first Add the NWI section, before adding any posts, I have the option to Import posts from another NWI section AND the associated Page Settings will be applied.  This also imports ALL associated Groups and Tags.

import function

As long as no post has been made in the respective NWI section, posts from the classic news module, other NWI sections as well as topics can be imported automatically. The page settings of the source page are applied. When importing Topics posts, however, manual rework is still required, if the "Additional Images" function was used in Topics.

I do not want to import any of the posts, groups or tags data from the source section, I just want to import the Page Settings.  I know I could create a blank NWI section with the Page Settings I need and use as a template to Import into New NWI Page Settings.  And I will likely do this, if there is no other option.

But further, I am wondering, if there is any way to use the import function to import JUST the Page Settings AFTER posts have been added to NWI pages (both source and destination NWI sections)?  There are many occasions, when over time it is decided to change the NWI Page Settings, and if you have dozens of NWI sections, this can be a VERY laborious task to manually copy and paste the Page Settings to each dialogue box on each section of each page.

Online

#2 10.09.2021 06:51:05

florian
Administrator

Re: NWI Import of Settings ONLY

Switch to advanced view. At "options" on the very bottom you find the select box "Presentation / View".
The values for this come from the directory /modules/news_img/views. Each view consists of a config.php and a frontend.css.
Take the "default" directory as a blueprint and create a new view, or alter the default settings. After saving, the new/changed view can be choosen from the mentioned select box.

Online

Liked by:

losttrip

#3 10.09.2021 15:04:59

losttrip
Member

Re: NWI Import of Settings ONLY

This is AMAZING!  So much better than any process I had hoped for!  THANK YOU to all who have worked on this module!

You really owe it to yourselves to document this extensive usability of NWI and make it available to all WBCE users.  So many improvements.

I have read the Readme, and I was already using advanced view, for Tags, but had no idea what the "Presentation/View" setting was for.  I already had many posts, so I didn't want to play around with that option and have a problem occur.  I should have set up a test section and tried figuring it out myself.

Online

#4 10.09.2021 18:16:45

losttrip
Member

Re: NWI Import of Settings ONLY

I apologize in advance for this wordy question.

I need more understanding of how the Presentation / Views work, and where the changes to the "current" Settings are saved, when I click Save.

Currently "Default" is selected in News Settings on all NWI pages.  At the bottom of the Advanced view, below Presentation / Views, it says "After changing the setting, hit save; the markups for post loop and post details view will be adjusted automatically.".  I presume that means, if I change the View to "faq" and click save, then the config and css settings from the faq view will replace what is currently in place.  Is that correct?  If so, then I understand that much.

What I am having trouble understanding is - When I make changes to the current News Settings (change post loop etc.) and "default" is in place as the Presentation / View... then when I click save, where are those changes saved?  In the database?  They are not saved in the / modules / news_img / views / default / config.php file, because when I compare the News Settings on my admin page, they do not match the settings in / modules / news_img / views / deafult / config.php

...and so, why then, when I click Save, do the settings in place under / modules / news_img / views / deafult / config.php not replace the changes I have made manually in News Settings?  Of course, I do not want that to happen, I'm just trying to understand how this works, and why, when "default" is shown in Presentation / Views, and you click save, the settings in / default / config.php do not replace what I have manually changed (like they do if I select "faq"), as is explained here - "After changing the setting, hit save; the markups for post loop and post details view will be adjusted automatically.".

I am asking ALL of THAT, because I am trying to set up as much automation as possible for my client, so they have as little as possible to remember.... because the reality is, they won't remember.

What I want is for the News Settings that are in place when you add a new NWI section to a page to be the custom Settings I create in e.g.,  / modules / news_img / views / mycustom / config.php
For instance, right now "default" is always the selection when a new NWI page is created.  So if the choices are:
default
faq
mycustom

My client would have to change the view to "mycustom" on every page they create, then click save.  I know it sounds like a silly question, but Is "default" ALWAYS the default that will appear in this window?  (How/where is this set?)  If so, then I understand I should make my custom changes to the "default" files in / modules / news_img / views /
But, if there is a way to choose which folder is used as the default, then I would prefer to have "mycustom" show when new News pages are added.  My understanding is that the default view files may/will be overwitten in updates, where as custom views will not.

Ultimately, I am wondering if once I have say 50 NWI pages in place, full of posts, all using the "mycustom" News Settings... can I then (in the future) make changes to the / modules / news_img / views / mycustom / config.php file and have those changes be instantly reflected on all 50 pages?  I am hoping so, as this would make bulk design changes amazingly efficient.

Or, will each of the 50 NWI pages retain whatever is in place on their individual News Settings page (from the database?)?  Forcing the creation of a new View (e.g., / modules / news_img / views / mynewcustom / config.php ), and then manually selecting that "mynewcustom" view in the News Settings of each of those 50 NWI pages?

Thank you!

Online

#5 11.09.2021 08:46:44

florian
Administrator

Re: NWI Import of Settings ONLY

The behaviour of the views is as follows:

  • If you change the view settings, all values in the fields above are overwritten with the code from the selected view. That means, customized code will be lost.

  • The settings for each NWI page are stored in the database.

  • If you change the current page settings, this has no effect on the view files.

  • For new NWI pages, always the current code from the config.php in the "default" view folder is used.

  • If you change that code, new NWI pages will use the changed code, but nothing changes on existing NWI pages.

  • To make it as simple as possible for your client, change the code of the default view according to your customer's needs, but, you're right, this customizing will be overwritten on WBCE/NWI updates. Unfortunately there's no way to make a custom view the default one.

  • A custom NWI view has always to be selected manually in the options (which is only possible in expert mode).

  • Also: If you change a custom view, the changes will be applied to new NWI pages or when again the view is selected in the options, but it will not be applied automatically to existing NWI pages.

  • There's no way to apply changes to a bunch of NWI pages at once. .

Last edited by florian (14.09.2021 09:21:33)

Online

Liked by:

losttrip

#6 13.09.2021 10:18:28

webbird
Administrator

Re: NWI Import of Settings ONLY

To have a custom view that is safe from updates, copy the view that comes as close to your needs as possible into a new folder in the 'views' subdirectory. This folder will appear in the selection. You can now change the contents of the config.php and frontend.css according to what you need.

To figure out your markups, play with them in an NWI section until they fit your needs. Then, copy the contents of the textareas to the config.php. For example:

[== PHP ==]
$post_loop = '<div class="mod_nwi_group">
    <div class="mod_nwi_teaserpic">
        <a href="[LINK]">[IMAGE]</a>
    </div>
    <div class="mod_nwi_teasertext">
        <a href="[LINK]"><h3>[TITLE]</h3></a>
        <div class="mod_nwi_shorttext">
            [SHORT]
        </div>
        <div class="mod_nwi_readmore" style="visibility:[SHOW_READ_MORE];"><a href="[LINK]">[TEXT_READ_MORE]</a></div>
        <div class="mod_nwi_bottom">
            <div class="mod_nwi_tags">[TAGS]</div>
        </div>
    </div>
</div>
<div class="mod_nwi_spacer"><hr /></div>';

Just replace all text between the quotes. The variable names should be quite comprehensible.


Ich habe eine Amazon-Wishlist. wink Oder spende an das Projekt.
Ich kann, wenn ich will, aber wer will, dass ich muss, kann mich mal

Offline

Liked by:

losttrip

#7 13.09.2021 10:40:56

webbird
Administrator

Re: NWI Import of Settings ONLY

losttrip wrote:

But, if there is a way to choose which folder is used as the default, then I would prefer to have "mycustom" show when new News pages are added.  My understanding is that the default view files may/will be overwitten in updates, where as custom views will not.

I'm afraid this is not as stringent as it should be. In fact, when adding a new NWI section, the settings that are used are hardcoded in the add.php file. So for now, you would have to change the defaults there and keep a copy of that file on a safe place. When doing an upgrade to the module, you will have to edit the add.php to put your changes in place again.

In general, the templates are intended as a basis for making your own adjustments afterwards. Therefore, changes made via the backend settings are "only" saved in the database and only for this one section. Of course it would make sense to have an option to save your changes as a new view, and to allow to set a custom default in the module somewhere. But at the moment, there is no such option available.

losttrip wrote:

Ultimately, I am wondering if once I have say 50 NWI pages in place, full of posts, all using the "mycustom" News Settings... can I then (in the future) make changes to the / modules / news_img / views / mycustom / config.php file and have those changes be instantly reflected on all 50 pages?  I am hoping so, as this would make bulk design changes amazingly efficient.

Or, will each of the 50 NWI pages retain whatever is in place on their individual News Settings page (from the database?)?  Forcing the creation of a new View (e.g., / modules / news_img / views / mynewcustom / config.php ), and then manually selecting that "mynewcustom" view in the News Settings of each of those 50 NWI pages?

Unfortunately, yes. You would have to create an SQL statement to update all your sections at once and execute it using phpMyAdmin or Adminer, for example.
(As far as I know, the "old" Topics module has an option to change the settings of all sections at once, but the "old" News module didn't have such an option and so the "new" NWI doesn't have it, too.)

By the way, I am very happy about the many questions and suggestions that have brought up many new aspects that I can consider in my next module "Journal". This is not intended as a successor to NWI, but it has similar basic functions, but also very high system requirements. For example, PHP8 is a minimum requirement. Maybe someone else can implement some of your ideas into NWI, too.


Ich habe eine Amazon-Wishlist. wink Oder spende an das Projekt.
Ich kann, wenn ich will, aber wer will, dass ich muss, kann mich mal

Offline

Liked by:

losttrip

#8 13.09.2021 18:21:39

losttrip
Member

Re: NWI Import of Settings ONLY

I appreciate you both making the effort to read my lengthy messages, and to then educate me in detail on all this.  Your time is not taken for granted, believe me.

I do understand the process of setting up custom Views, and I greatly appreciate having that ability.  This will likely be the path I take.

Thank you for the hint at editing add.php.  I may go that route, I have not decided yet.  I do understand that I would need to maintain that file after further module updates, so I have to weigh which approach will be best for me and my client.

Thank you, again!

Online

Board footer

up