Jump to content

Pages Category Images / Pages Searchable Text Fields

All Astronauts

Recommended Posts


Finally got this patched for 4.5/4.6 - will require no changes on your end at all. Might even be slightly faster (everything is datastore cached).

I'll be uploading 3.x tonight and it will be approved when it is approved as all things MP are these days. I'll also post here again after I submit with the low-down.


Edited by All Astronauts
Link to comment
Share on other sites

PCI Version 3.0.2 submitted.

4.5.x and 4.6.x compatible.

This moves all your images off the actual Pages Categories database table into a separate table.

You do NOT need to change any of your template code; this remains 100% compatible with whatever you are doing before.

Code examples for a reminder:

<img src='{file="$category->pcimage"}'>

The above where you have the $category variable available.

<img src='{file="$record->container()->pcimage"}'>

And that above for when you are in a record view template and have the $record variable available. You should be able to see the basic chain there record - then it call the container (which is the category the record is in) - and then our category image.

I do have caching of the new PCI database table. 99.99% it will never be a problem, when the category is being built out it actually double checks for the cache and if not there does a load from the DB directly. If something happens though, you can refresh the cache directly in the ACP on the Pages Databases menu option and any database Categories menu option with the obvious, can't miss button up top.

EDIT: Will edit/post when it is approved.

Edited by All Astronauts
Link to comment
Share on other sites

🤷‍♂️ maybe they're busy? EDIT: Will be awhile longer; you can use the same Giphy I already used.

ANOTHER EDIT: Daniel managed to find this one tiny thing out of the expansive pile of apps and plugins I have (There are a lot on my dev machine that never see the light of public day) that had this one thing leftover in a post-install routine. They probably aren't paying him enough.

Edited by All Astronauts
Link to comment
Share on other sites

  • 1 month later...

Installed and tried to update a category and got this error:

UPDATE `ipb_cms_database_categories` cms_database_categories  SET `category_pcimage`='monthly_2021_07/Themes.png.887b794354ac36921365535fe9f395f9.png',`category_show_records`=true,`category_can_view_others`=true,`category_allow_anonymous`=false,`category_forum_override`=false WHERE category_id=190 
IPS\Db\Exception: Unknown column 'category_pcimage' in 'field list' (1054)
#0 /home/jimiwikm/public_html/system/Db/Db.php(1154): IPS\_Db->preparedQuery('/*jimiwikm_siri...', Array)
#1 /home/jimiwikm/public_html/system/Patterns/ActiveRecord.php(520): IPS\_Db->update('`ipb_cms_databa...', '`category_pcima...', 'WHERE category_...')
#2 /home/jimiwikm/public_html/system/Node/Model.php(2452): IPS\Patterns\_ActiveRecord->save()
#3 /home/jimiwikm/public_html/applications/cms/sources/Categories/Categories.php(837): IPS\Node\_Model->save()
#4 /home/jimiwikm/public_html/system/Node/Model.php(3274): IPS\cms\_Categories->save()
#5 /home/jimiwikm/public_html/system/Node/Controller.php(420): IPS\Node\_Model->saveForm(Array)
#6 /home/jimiwikm/public_html/system/Dispatcher/Controller.php(90): IPS\Node\_Controller->form()
#7 /home/jimiwikm/public_html/system/Node/Controller.php(69): IPS\Dispatcher\_Controller->execute()
#8 /home/jimiwikm/public_html/applications/cms/modules/admin/databases/categories.php(61): IPS\Node\_Controller->execute()
#9 /home/jimiwikm/public_html/system/Dispatcher/Dispatcher.php(153): IPS\cms\modules\admin\databases\_categories->execute()
#10 /home/jimiwikm/public_html/admin/index.php(13): IPS\_Dispatcher->run()
#11 {main}


Link to comment
Share on other sites


@Jimi Wikman What version did you install? Just to be sure, you are using the application right? There is no code in the newest release that interacts with cms_database_categories other than to copy images to a new table and remove the PCI column from that table.

The error you are showing can only appear if you are using some old stuff somehow. Shoot me an account with ACP access (via PM) and I can take a quick look

Link to comment
Share on other sites

Fixed. I've asked for an accelerated review to get the patch out there.

The hitch was in how these are now added to Categories. It gets merged into the object and that's all well and good front-side, but troublesome with saves on the admin side. I got no idea how I missed this 🤷‍♂️ as it's rather apparent when hit. Effectively a one-line addition to fix.

Anyhoo, now that this is set for 4.5/4.6 I'll make a point to look at supporting thumbnail versions of the images and adding an additional field for an array of images which you can then throw at a carousel or something.

Link to comment
Share on other sites

And fixed again... Ya know, when IPS let us add fields to IPS application tables, this mod was a dorky simple set-it-and-forget-it thing. Now, ugh.

Put simply, I spaced that interacting with records would actually end up re-saving the category as well, and on the front-end, with the background image merged into the Category object that means when those edits/saves occur, it tries to save the Category with refreshed information and hits that background image and tries to save it in the Category table and the field ain't there, etc...

I fixed this, ate lunch to give some space, then gave it another run through. I believe I've done all the front-end testing possible. I've hit all the mod actions in record view and category view, plus new records saves, edits, and deletes. Commenting and Reviews on records cleared as well. 

If this still errors out after this (I don't believe it will but...) I'll need to rip off the band aid and make you guys edit your templates.

Instead of $category->pcimage to get at the thing it would be something different. Probably a template plugin like {pci=$category}.

Sorry for the hassle. Available when its available (3.0.6)

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

That's gonna be some weirdness on your end.

$lang = array(
	'__app_pci'	=> "Pages Category Images",
	'pciFormTab' => "Category Image",
	'category_pcimage' => "Category Image",
	'pciInfos' => "You can use this image anywhere the category variable is available to you in Pages templates. Please see the description for this plugin in the Marketplace or visit the support topic for more details.",
	'filestorage__pci_PagesCatImages' => "Pages Category Images",
    'pci_refreshdatastore' => 'Refresh Pages Category Images Caches',
    'pci_refreshdatastore_refreshed' => 'PCI Datastore Cache Refreshed',

Been there forever. Two cents: Sometimes when installing apps and plugins, if whatever is having time out problems or sync problems (see this a lot on CIC) the install finishes but not correctly (for non-MP installs on CIC I check for S3 file write timeouts in the system logs, if I see them, I know the plugin/app failed the install and repeat until I see that clear)

Normally I'd say uninstall and reinstall but you lose your cat images that way so that's a no go. I think you'll have to live with it until a new release is out and hopefully the upgrade catches the existing language string and correctly adds it.

Now when that update occurs??? Any suggestions?

Link to comment
Share on other sites

Years of this. Usually goes along the lines of install plugin, whatever, process completes, no hooks, or no css or ???. Check system logs, see S3 time outs or write fails or, yeah yeah he remembers, hitting S3 write rate limits. So, rinse repeat, until after an install or upgrade (those too of course) I see no system log errors, then I know its fine.

NOTE: Have not installed anything on CIC in maybe six months? And no I cannot remember the exact last time this occurred, but has been common for years (way way back). I've always chalked it up to some upstream shenanigans and not an IPS problem per-se. Not sure what you can do other than throw some verification steps after each "process" in the install routine.

Tell ya what, the next time this occurs I'll make a note to copypasta the system logs and so on and so forth and loop you in.

Link to comment
Share on other sites

40 minutes ago, All Astronauts said:

NOTE: Have not installed anything on CIC in maybe six months?

That's like 100 internet years?! A lot changed in the last year🤷‍♂️

Please feel free to send me an email ( my name here + @invisionpower.com ) ASAP you or one of your clients runs into such an issue again.

Link to comment
Share on other sites

  • 8 months later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...