Page 1 of 1

Two beginner's questions

Posted: Sun May 26, 2024 8:39 am
by whitecat
Hi there,

I'm currently looking for a blog software for a friend who wants to build some kind of a travel blog. Much text, some pictures, that's all, thus something Wordpress could have handled 15 years ago. However, nowaday's Wordpress is far too oversized for this small project, so I searched for an alternative and found FlatPress.

There are some special requirements though:

1. The blog will be strictly private. Readers of this blog must authenticate in one or another way (username/password is sufficient). No exceptions! However, I haven't seen this functionality in FlatPress, neither in its core nor as a plugin. Is there a (simple) built-in technique to achieve this goal? Did I miss anything? (Of course, plain http authentication would be an option, but it's more cumbersome to create new user "accounts" this way; I would have to do this for my friend, who is a photographer, not an IT administrator.)

2. The blog articles will contain many pictures, all in all a few hundreds of them. Is there a possibility to batch upload them instead of uploading each picture separately? (E. g. upload a huge zipfile or transfer the pictures via an FTP client into a special directory)? Again I haven't found an out-of-the-box solution, but maybe I just missed it.

Thank you.

whitecat

Re: Two beginner's questions

Posted: Fri May 31, 2024 8:06 pm
by Arvid
Hi and welcome to FlatPress!

For the contents you describe, FlatPress should be just right.
But... :)
whitecat wrote: Sun May 26, 2024 8:39 am1. The blog will be strictly private. Readers of this blog must authenticate in one or another way (username/password is sufficient). No exceptions! However, I haven't seen this functionality in FlatPress, neither in its core nor as a plugin. Is there a (simple) built-in technique to achieve this goal? Did I miss anything? (Of course, plain http authentication would be an option, but it's more cumbersome to create new user "accounts" this way; I would have to do this for my friend, who is a photographer, not an IT administrator.)
Indeed, FlatPress does not support that out of the box - my first approach would also be HTTP authentication via htaccess. This is of course not great if you do not have a static portion of users.
Thinking ahead, one could create a plugin that at least helps adding users to the htpasswd file.

Alternatively, using a single username/password combination for all readers may do the job as well, depending on your audience - and security requirements.
whitecat wrote: Sun May 26, 2024 8:39 am2. The blog articles will contain many pictures, all in all a few hundreds of them. Is there a possibility to batch upload them instead of uploading each picture separately? (E. g. upload a huge zipfile or transfer the pictures via an FTP client into a special directory)? Again I haven't found an out-of-the-box solution, but maybe I just missed it.
It's no problem to upload many pictures at once via FTP to the fp-content/images folder. FlatPress will automatically create the thumbnail for the images when they are first shown on the blog.
I use this regularly on my own blog, especially to fill galleries: After creating the new gallery with the Uploader in the Admin Area, I upload the images to fp-content/images/NameOfTheGallery. With the Gallery Captions plugin, I then create the caption for each image. (Example entry on my blog; gallery at the bottom.)

Let us know if that helps you :)
All the best,
Arvid

Re: Two beginner's questions

Posted: Wed Jul 31, 2024 1:27 pm
by whitecat
Hi Arvid,

it's only now that I'm able to continue with this project, but I'm currently trying out FlatPress on my webspace. The next questions will come soon :D
Arvid wrote: Fri May 31, 2024 8:06 pm It's no problem to upload many pictures at once via FTP to the fp-content/images folder. FlatPress will automatically create the thumbnail for the images when they are first shown on the blog.
I use this regularly on my own blog, especially to fill galleries: After creating the new gallery with the Uploader in the Admin Area, I upload the images to fp-content/images/NameOfTheGallery. With the Gallery Captions plugin, I then create the caption for each image. (Example entry on my blog; gallery at the bottom.)
Good to read, and it works. However, If I upload the pictures into subdirectories of fp-content/images with an FTP client (for reasons of clarity, I don't want to have several hundred pictures in one directory), I'm not able to include them into a new blog entry via the dropdown list. (If I specify the path in the img tag manually as images/subdirectory/example.jpg, it works.) Did I miss something?

missing_images_in_subdirectories.png
missing_images_in_subdirectories.png (22.82 KiB) Viewed 79498 times

whitecat

Re: Two beginner's questions

Posted: Fri Aug 02, 2024 10:35 pm
by fraenkiman
Hello whitecat,
whitecat wrote: Wed Jul 31, 2024 1:27 pm I'm not able to include them into a new blog entry via the dropdown list. (If I specify the path in the img tag manually as images/subdirectory/example.jpg, it works.) Did I miss something?
you have not overlooked anything. Currently, the dropdown selection does not offer a subdirectory selection.
You would have to drill down the plugin_bbcode_init_toolbar() function in the plugin.bbcode.php file. I have created a improvement suggestion.

With best regards
Frank

Re: Two beginner's questions

Posted: Sat Aug 03, 2024 6:49 am
by whitecat
Hello Frank,

thank you for your reply. This is not a showstopper for my project, as it is possible to use BBCode directly in the postings, which my friend will be able to do as well.

As expected, some more questions popped up during my first attempts:

3. (the most important): As this will be a report of some past journeys, the entries should appear in ascending order of their dates, thus just the opposite of a usual blog, where the entries are shown in descending order. However, I haven't found the right place to change this, neither in the settings nor somewhere in the code. Do you have an idea how to achieve this goal? At least there must be a place in the code where the entry files get sorted in ascending order.

4. As I read somewhere in the wiki oder here in this forum, it's impossible to change the timestamp of an entry once it's created, at least "officially". Maybe this will be a requirement in the future, e. g. in case if it turns out that an entry is too long and would better be split up into two parts. Considering the fact that the timestamp information must be somewhere in the filesystem, I have looked around and have found four references to it (the files entry<timestamp>.txt, the directories entry<timestamp>, the field DATE, the yy/mm/dd directory structure). So I tried to change all four references to their new values, rebuilt the index afterwards and it seems to work. Is this a safe "hack" to change an entry's timestamp subsequently or does this approach break anything? Are there more files/directories to change in this case?

5. Is there an update-safe place for some custom CSS files or would it be best to change the theme's CSS files?

(I have basic knowledge of PHP, JavaScript and CSS, so maybe I will be able to patch the code myself if you point me in the right direction.)

Thank you.

whitecat

Re: Two beginner's questions

Posted: Sat Aug 03, 2024 1:05 pm
by Arvid
whitecat wrote: Wed Jul 31, 2024 1:27 pmHowever, If I upload the pictures into subdirectories of fp-content/images with an FTP client (for reasons of clarity, I don't want to have several hundred pictures in one directory), I'm not able to include them into a new blog entry via the dropdown list. (If I specify the path in the img tag manually as images/subdirectory/example.jpg, it works.) Did I miss something?
Hm, there's a difference between images and gallery images. The images selectbox in the editor does indeed only show the contents of fp-content/images. I doubt it would be good to add the images from the gallery subdirectories there as well - over time, the selectbox may have to display gazillions of individual options.
Is it really neccessary for you to display the images individually in your entries? The gallery tag would do the trick as well:

Code: Select all

[gallery="images/2024-08-03_MyGallery" height="100"]
It's no problem to display more than one gallery per entry.


whitecat wrote: Sat Aug 03, 2024 6:49 am3. (the most important): As this will be a report of some past journeys, the entries should appear in ascending order of their dates, thus just the opposite of a usual blog, where the entries are shown in descending order. However, I haven't found the right place to change this, neither in the settings nor somewhere in the code. Do you have an idea how to achieve this goal? At least there must be a place in the code where the entry files get sorted in ascending order.
Oof. I'm not sure how that could be achieved even remotely easily. This concerns the very core of FlatPress; you may have a deep look into the fp-includes/core files, especially core.bplustree.class.php, core.filesystem.php, and core.fpdb.class.php.


whitecat wrote: Sat Aug 03, 2024 6:49 am4. As I read somewhere in the wiki oder here in this forum, it's impossible to change the timestamp of an entry once it's created, at least "officially". Maybe this will be a requirement in the future, e. g. in case if it turns out that an entry is too long and would better be split up into two parts. Considering the fact that the timestamp information must be somewhere in the filesystem, I have looked around and have found four references to it (the files entry<timestamp>.txt, the directories entry<timestamp>, the field DATE, the yy/mm/dd directory structure). So I tried to change all four references to their new values, rebuilt the index afterwards and it seems to work. Is this a safe "hack" to change an entry's timestamp subsequently or does this approach break anything? Are there more files/directories to change in this case?
Seems correct to me - even more, as it works perfectly on your blog :)


whitecat wrote: Sat Aug 03, 2024 6:49 am5. Is there an update-safe place for some custom CSS files or would it be best to change the theme's CSS files?
Isn't the theme always custom, even if it's based on a default theme? I recommend simply creating a copy of the original theme and use it as you own theme from then on - updates will not overwrite your own theme (as long as it has an individual folder name).


All the best
Arvid

Re: Two beginner's questions

Posted: Sat Aug 03, 2024 6:14 pm
by whitecat
Arvid wrote: Sat Aug 03, 2024 1:05 pm Hm, there's a difference between images and gallery images. The images selectbox in the editor does indeed only show the contents of fp-content/images. I doubt it would be good to add the images from the gallery subdirectories there as well - over time, the selectbox may have to display gazillions of individual options.
So the subdirectories are meant only for the gallery function, not for organizing the pictures? Anyway, this is not my main concern as it's always possible to type in (or copy&paste) the [img] manually with the subdirectory instead of picking it from the dropdown list.
Arvid wrote: Sat Aug 03, 2024 1:05 pm Is it really neccessary for you to display the images individually in your entries? The gallery tag would do the trick as well:

Code: Select all

[gallery="images/2024-08-03_MyGallery" height="100"]
It's no problem to display more than one gallery per entry.
I will try it out.
Arvid wrote: Sat Aug 03, 2024 1:05 pmOof. I'm not sure how that could be achieved even remotely easily. This concerns the very core of FlatPress; you may have a deep look into the fp-includes/core files, especially core.bplustree.class.php, core.filesystem.php, and core.fpdb.class.php.
Will do. There must be some code that defines the order of the entries. The iterator {entry_block} must be defined somewhere. If I find something out, I will post it here for future reference.
Arvid wrote: Sat Aug 03, 2024 1:05 pmIsn't the theme always custom, even if it's based on a default theme? I recommend simply creating a copy of the original theme and use it as you own theme from then on - updates will not overwrite your own theme (as long as it has an individual folder name).
I will probably do it this way.

Thank you for your support.

whitecat

Re: Two beginner's questions

Posted: Sun Aug 04, 2024 6:27 pm
by whitecat
whitecat wrote: Sat Aug 03, 2024 6:14 pmThere must be some code that defines the order of the entries. The iterator {entry_block} must be defined somewhere. If I find something out, I will post it here for future reference.
It's easier than expected: Line 104 of defaults.php reads:

Code: Select all

define('BPT_SORT', SORT_DESC);
The constant 'BPT_SORT' is referenced in the file fp-includes\core\core.bplustree.class.php and controls the compare function BPT_keycmp which is (hopefully) used for any kind of comparisons regarding the order of the entries.

So a simple change in defaults.php

Code: Select all

define('BPT_SORT', SORT_ASC);
does the trick. At a first glance it works (after rebuilding the index). I will test it more thoroughly tomorrow.

whitecat

Re: Two beginner's questions

Posted: Tue Aug 13, 2024 6:22 am
by whitecat
Hi there,

it's me again. My site is growing constantly and it's soon ready to be released (although not to the public as it is a private site for only a handful of readers, protected by HTTP basic authentication). Until now I was able to implement all requests, sometimes by adding some CSS, but occasionally I had to patch the code.

The method of inverting the order of the entries via the BPT_SORT constant (see above) generally works well, with one exception. (Maybe this method could be made "official", e.g. by commenting it in the code and documenting it in the wiki?)

The one exception manifests in two ways:

1. The {nextpage}/{prevpage} elements show different texts ("Next page/Previous page" or the titles of the previous/next page) depending if the user uses the comment function or not. This is independent of the value of BPT_SORT and looks like a real bug to me.

2. If BPT_SORT is set to SORT_ASC, the {prevpage} element is missing on the page if (and only if) the comments are shown.

I tried to track it down and suspect the bug to be in the file core.fpdb.class.php (functions getNextPage()/getPrevPage()), but got stuck there due to my lack of knowledge of the inner architecture of FlatPress. Maybe one of the developers reading this posting could help here? Both effects are easily reproducible with a fresh install of FlatPress 1.3.1, the default "Leggero" theme and three dummy entries, so it's not a problem of my own modifications.

Let me know if you want me to elaborate further, e.g. with some screenshots. What's the best place to file a bug report or request? Here in the forum (as a new thread) or as an issue on GitHub?

Thank you for creating FlatPress. A donation will follow soon!

whitecat

Re: Two beginner's questions

Posted: Tue Aug 20, 2024 10:30 pm
by fraenkiman
Hello whitecat,

I'm not sure if the {nextpage}/{prevpage} elements are a feature or a bug. Arvid should have a look at that as well. I currently know of five different places where “back/forward” is used. Comment function, entries and admin area (Uploader->Media Manager, entries list, page list).
Please attach bug reports and a few screenshots to the FlatPress repo for reproducibility.

With best regards
Frank