Jump to content

Same Images for multiple pages


bbeer
 Share

Recommended Posts

Hi all

we are building a dynamic user manual, for approx. 800 products. In those manuals we have to use Icons, to be used with CKEditor. As the Images in PW are saved per Page, I wonder if there is a solution to use the same images in all those pages. Related pages won't help, neither will selecting Images from a singe page as images can't be replace, well not that I know of. 

I would need a library where I would save this 20 Icons, to be used in all the other documents. Important is, that the Icons can be replaced in one place, and they will be replaced in all the other documents as well.

your help is much appreciated!

Link to comment
Share on other sites

Hi bber,

this look kind easy to do (if I understand correctly what you need).

Personally I would create a page called "Icons" and then put inside an imagefield (multiple) to store all the icons I need, then create several Hanna codes to echo those icons out. So when an icon will be changed, all its instances in the ckeditor would get updated.

Does it make sense? :)

  • Like 1
Link to comment
Share on other sites

Hi 3fingers

I think you got it what I mean. The same Images for close to 800 Documants, that need to be replaced at once if needed. I also understand that with the page, but Hanna Cod I have no Idea. Have to have a look into. Never used it so far.

Link to comment
Share on other sites

You can learn more about Hanna Code here.

Basically you can use a short code like [[icon-news]] or [[icon-check]] (where icon-* could be whatever you decide) to echo out a php/html/js snippet into your ck-editor.

Let's say you want to create an Hanna Code called [[icon-pen]] :

<?php

$path = $pages->get("/path/to/Icons/");
// or whatever selector to get the Icons page

echo "<img src='{$path->icons[0]->url}'>";
// where "icons" is the name of the imagefield-multiple and [0] is the index of the icon-pen that you want to echo out

?>

Now your snippet will refer to [[icon-pen]], and you can insert it inside your ck-editor.

This is a very simple example and should be modified to your needs, but I think you got the idea.

Another idea is that you could also create a function and have the index of the icon as a parameter to change on the fly inside your hanna code.

  • Like 2
Link to comment
Share on other sites

In the PWImage-plugin for the editor is a option to choose images from other pages.

But I would also go with the hanna code version, as it updates if the image gets changed, while the pwimage plugin only inserts the code for the image and doesn't care more about it. 

  • Like 1
Link to comment
Share on other sites

For a little page with less images i've set a couple of images in a pagetree called images with ebers image=page (one image per page) so the file can change but the link stays...imagemanagment would be done easy on the pagetree or a special adminpage.

Take a look - should work with icons, too since icons are images....mostyl. ;)

https://processwire.com/talk/topic/7836-cant-wait-first-project-with-pw-nearly-finished/

Hanna code works for shure! but if you wanna use the PWImage Chooser you can work with this one and the modification of the startingpoint for Images like there:

https://processwire.com/talk/topic/7439-processpageeditimageselect-hook-and-change-default-page/

Regards mr-fan

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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