Jump to content

Pages Category Images / Pages Searchable Text Fields


Recommended Posts

The thing is, I didn't. There are no template hooks of any kind in this plugin.

All I do is provide a way to add an image to the category object, what you do with it is all on you. You have to manually add the images to your templates.

And how do I use this?
Images are stored wherever you have set the Pages Category Images file handler set to store them and you can access the image anywhere the $category variable is available to you in Pages templates.

$category->pcimage = The local url to the stored image. You will rarely use this by itself as it will return "uploads/monthly_07/thisismyimagename_34erjfhrufhdheh.jpg" or something along those lines.

{file="$category->pcimage"} = The COMPLETE url to the stored image. "https://myawesomesite.com/uploads/monthly_07/thisismyimagename_34erjfhrufhdheh.jpg". Just sticking this in a template will output that as a line of text.

<img src='{file="$category->pcimage"}'> = The image will be displayed in your template at this location at full size.

You get the idea. From here you can format the image with css, use it as a background element, and so on. 

Link to comment
4 minutes ago, All Astronauts said:

All good? Willing to lend a hand if needed.

can you tell me what css i need to add to my custom css to make the category images not over lap the text on smaller screens?

https://www.mymilitia.com/intel/ and https://www.mymilitia.com/atlas/alabama/

i figure they should get smaller with the page or display inline dunno

Edited by fix3r
Link to comment

    Two things are at play here. We'll use Alabama and the State Parks sub cat as that has maps in it.
    First - both the State Parks line (title) and the 3 maps bit beneath, have a margin left on them to give room for the icon
    
    Second is of course the icon size itself.
    

@media screen and (max-width: 979px) {
    
html[dir="ltr"] [data-blockid="app_cms_Database_1382758328"] .ipsDataItem_icon:not( .ipsResponsive_hidePhone ):not( .ipsResponsive_hideTablet ) + .ipsDataItem_main, html[dir="ltr"] .ipsDataItem_icon:not( .ipsResponsive_hidePhone ):not( .ipsResponsive_hideTablet ) + .ipsDataItem_main + .ipsDataItem_stats {
    margin-left: 55px;
}

[data-blockid="app_cms_Database_1382758328"] .ipsDataItem_icon.ipsDataItem_category img {
	max-width: 45px;
}

}

The above, on tablet and phone views, increases the margin left on those aforementioned bits from 45px to 55px. The second bit sets the size of the icon.

The [data-block... provides targeting to ONLY this pages view. Without it this will spill over into all the other places in the suite that use those css bits.

phone.PNG.277d7b290275bebad084cfef068542ed.PNG

That's the above on phone view. Adjust as needed. 

If you need to adjust these cat images you are inserting as icons in other IPS databases you will need to change the [data-blockid... bit to what it needs to be for that block. You can spot it when inspecting the page with your browser tools.

Link to comment

Make this bit:

html[dir="ltr"] [data-blockid="app_cms_Database_1382758328"] .ipsDataItem_icon:not( .ipsResponsive_hidePhone ):not( .ipsResponsive_hideTablet ) + .ipsDataItem_main, html[dir="ltr"] .ipsDataItem_icon:not( .ipsResponsive_hidePhone ):not( .ipsResponsive_hideTablet ) + .ipsDataItem_main + .ipsDataItem_stats {
    margin-left: 55px;
}

This:

html[dir="ltr"] [data-blockid="app_cms_Database_1382758328"] .ipsDataItem_icon:not( .ipsResponsive_hidePhone ):not( .ipsResponsive_hideTablet ) + .ipsDataItem_main, html[dir="ltr"] .ipsDataItem_icon:not( .ipsResponsive_hidePhone ):not( .ipsResponsive_hideTablet ) + .ipsDataItem_main + .ipsDataItem_stats {
    margin-left: 55px !important;
}

Just add the !important

Link to comment
  • 4 months later...
  • 2 months later...

Both Pages Searchable Text Fields and Pages Category Images are in the clear for 4.5

PCI will need a tweak to be available in the 4.5 marketplace as it piggybacks on the Pages database tables directly and IPS doesn't want that any more. It is perfectly fine to use with 4.5 as is though so no worries - upgrade away.

Link to comment
  • 1 month later...

Pages Searchable Text Fields 3 submitted this afternoon.

4.5 compat, etc. etc. for all four of you using it. The current version you have is fine and works, but for the plugin to be in the ACP Marketplace I had to move my searchable flag off the Fields table into my own thing.

Pages Category Images will get in the new ACP Marketplace eventually... (it's a larger pain in the ass then it should be for a variety of IPS reasons). 

Edited by All Astronauts
Link to comment
  • 1 month later...

Just an update on this for Pages Category Images. There is zero wrong with using what you have with 4.5, knock yourself out. 

That aside, I might just submit the old version and see if it will pass even though it does add a column to an IPS table - reason being that IPS does not follow the standards for loading categories consistently in Pages, meaning the standard hook point one would use to join a table on to the categories table is a no-go and I'm not sure I can slip by this without going way upstream and doing crap no one should be doing.

Link to comment
  • 1 month later...

I had PCI disabled on my most recent 4.5.x installation, but when I enable it (or even if I don't), and try to click through to its Marketplace entry I get a red-window error saying: "3C409/G This file is not compatible with the version of Invision Community you are using."

So I assume this will interfere with updates at some point?  But I'm getting that at least for now it works fine with 4.5.4?

Link to comment
  • 3 months later...

When I want save field setting in my custom databases causing this error:

EX1054 Something went wrong. Please try again.

UPDATE `cms_database_fields` cms_database_fields  SET `field_validator`=false,`field_unique`=false,`field_required`=true,`field_html`=false,`field_display_listing`=true,`field_display_display`=true,`field_display_commentform`=false,`field_pstf_searchable`=true WHERE field_id=21 
IPS\Db\Exception: Unknown column 'field_pstf_searchable' in 'field list' (1054)
#0 /var/www/html/105128/system/Db/Db.php(1161): IPS\_Db->preparedQuery('/*o283304::o283...', Array)
#1 /var/www/html/105128/system/Patterns/ActiveRecord.php(520): IPS\_Db->update('`cms_database_f...', '`field_validato...', 'WHERE field_id=...')
#2 /var/www/html/105128/system/Node/Model.php(2389): IPS\Patterns\_ActiveRecord->save()
#3 /var/www/html/105128/applications/cms/sources/Fields/Fields.php(2794): IPS\Node\_Model->save()
#4 /var/www/html/105128/system/Node/Model.php(3314): IPS\cms\_Fields->save()
#5 /var/www/html/105128/system/Node/Controller.php(413): IPS\Node\_Model->saveForm(Array)
#6 /var/www/html/105128/system/Dispatcher/Controller.php(90): IPS\Node\_Controller->form()
#7 /var/www/html/105128/system/Node/Controller.php(62): IPS\Dispatcher\_Controller->execute()
#8 /var/www/html/105128/applications/cms/modules/admin/databases/fields.php(48): IPS\Node\_Controller->execute()
#9 /var/www/html/105128/system/Dispatcher/Dispatcher.php(152): IPS\cms\modules\admin\databases\_fields->execute()
#10 /var/www/html/105128/admin/index.php(14): IPS\_Dispatcher->run()
#11 {main}

 

Link to comment

It's missing the pci column in the table. Not sure where you got your copy from... (cough)

Anyways, it's been a been awhile, I'll poke this today to see if I can find a way to get this up to true 4.5 compatibility. It's fine if you got this from the MP but with the IPS MP rule to not allow cols on their own tables anymore, as mentioned further above, there are some hitches with Pages to get around that.

Link to comment

3.0.0 was released and it does solve the problem but someone brought an edge case to me so there is a 3.1.0 coming down the pipe. Submitted, approved and available when it's available.

Seems there is a tiny hitch when people would create a field but ignore the 'Searchable' tab completely and just hit save. Didn't feel like tracking it down the rabbit hole so just moved the searchable field to the bottom of the first tab and removed my searchable tab completely.

pstf_field_form.thumb.PNG.db51dfddb0cc802fe7fc79e01d3a55f5.PNG

Also added a burn-it-all-down option, a few language tweaks, etc.

  • FIX! Moved the form field for PSTF to resolve hitch when people just save the form without visiting the previous 'Searchable' tab in the form
  • CHANGE! Database titles used instead of keys in plugin rebuild search indexes options.
  • NEW! Option to wipe out all settings for searchable fields and start over, or not.
Link to comment
  • 4 months later...

Pretty sure its fine as is.

Apologies for anyone not getting responses to PMs here. I'm... behind.

As to this, I need to take another run at this. The problem is IPS will NOT allow any columns added to their own tables any more. Period. Full stop. I have this fixed for Pages for record view, and category view (I think - been awhile). But database index view is a problem as they do not active record that stuff. Its a direct database query. I get a little leery the further up I go, getting closer to lower level functions, for hooking and changing things. I probably shouldn't worry; I usually bullet proof stuff enough anyways to not spill over. But this is not as simple as slipping into the AR routines as Pages is messy in this regard (probably because the entire thing is an abstraction itself)

Anyways, I'll poke this bear. FYI most of my junk was updated to 4.6 but IPS staff are back-logged with MP approvals so might still be awhile.

Link to comment
  • Recently Browsing   0 members

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