Open captainharrie opened 3 months ago
Looking at the list of stuff available to show()
, it doesn't look like the latest page's info is fetched like that D: Presumably this is to avoid fetching page data all the time.
Getting the marker/chapter title is going to be a performance hit. See the discussion at #14 regarding getting the marker data for the current page. If we also have to do that twice more (for the first and latest page) on every single Grawlix page, I think it would be rather bad. So, it may be good to expose this information only to static pages, which would mean you'd not be able to have a "latest page" widget on comic pages, on the archive, etc, just in the interest of performance. It is possible to cache this data, and only update it when the comic is updated (pages are added/deleted/edited, sort order changes, markers are added/edited/deleted; this may be doable with triggers on the DB rather than via PHP). This way it would be cheap to fetch and we could expose it on every page, and an extra delay for the comic author should hopefully not be too bad. Caching would require a database schema change (fields to store the cached data, plus any triggers) and therefore a substantial Grawlix update. Fortunately, we're planning for the next update to be that anyway, as there's a backlog of features that require DB schema changes.
There's also the question of how this should interact with the fact that Grawlix supports multiple books, each of which have their own latest pages, and only comic pages (and I guess the archive page) know which book they're in, I think. I'm actually not very familiar with how multi-book Grawlix works, but IIRC the plan it to give that feature some love and incorporate it into core Grawlix precisely so that we stop breaking it every time we add a new feature ;D Once book IDs become a permanent fixture of Grawlix and are available everywhere that they may be relevant, there should be no more ambiguity regarding which latest/first page to show where.
When I initially looked at this issue I thought, "oh, this should be pretty easy to add", but then I started thinking about it, and you can see the result above ;D
For now at least, you should be able to "fake" a welcome page like this by setting Grawlix to display the latest page instead of a static page, and using PHP in your theme code to decide which style of page to show based on the URL - if it's the base URL, then show the condensed version and extra information, and if it's /comic/, show the regular comic page layout. I recommend trying this approach, as it will likely be a long time before Ayemae or I can get to this, especially since doing this feature right* requires finishing other features (full multi-book support) first. So, in page.comic.php in your theme, you can use something like this to create a variable that tells you whether you're currently on the welcome page:
<?php $welcomePage = ($_SERVER['REQUEST_URI'] == "/"); ?>
(You may need to adjust the above based on your install directory or whatever else.) Then wherever you want to display something differently, wrap it it with an if/else, e.g.
<?php if($welcomePage): ?>
your welcome page code, using all the data available to show() on comic pages
<?php else: ?>
your regular page code
<?php endif; ?>
Ooh okay, I'll go ahead and do that then! Thank you for pointing me in the right direction, that should be easy to do!! ❤️
Hello! I'm currently in the process of recreating my comicfury site with grawlix, and the landing page of my CF site displays some info for the latest page:
Is there any way I can get this information with Grawlix?