Pages (2): 1 2   
Member
Member
tosca   22-08-2013, 08:07
#1

I'm not sure how they are called in the english version; in french, I see them as 'Données personnalisées' in both the album and image page of the admin interface.

What can we put there, and how to format it? Unless I missed something, I didn't find any method to get the information that has been put in this field.

Thanks for your answer.

Member
Member
tosca   22-08-2013, 08:11
#2

Oops! Sorry, I just found the related functions in template-functions.php.
I guess that means the formating is free, and I need to decide how to store my own data in there.

Administrator
Administrator
acrylian   22-08-2013, 08:40
#3

Please just switch the admin to the English language if you are asking something like that. We really don't understand French. Otherwise we really cannot help.

Since this means apparently "custom data". That is an all purpose text field and it is up to you what you do with it exactly. You can attach The editor TinyMCE to it and use it like any other content field. You can add and output html or js code but not PHP code. For the latter the codeblocks are meant.

Member
Member
tosca   22-08-2013, 09:43
#4

Where/how can I switch language in the admin?

As for the custom data, I tried print $_zp_current_album->getAlbumCustomData(); but got the following error: Fatal error: Call to undefined method Album::getAlbumCustomData(). I am missing something, but what?

Administrator
Administrator
acrylian   22-08-2013, 10:50
#5
  1. On the options naturally

  2. Well if you didn't call it within album context it naturally doesn't work since the album object is not available (but this you should really know by now as a long time user :-)).

Member
Member
tosca   23-08-2013, 10:49
#6

I might be less-advanced level that you think. :-)

The line before print $_zp_current_album->getAlbumCustomData(); is print $_zp_current_album->getDesc(); and it works...

What could be the difference between those two?

Administrator
Administrator
acrylian   23-08-2013, 11:32
#7

Ok, I didn't look direclty but your mistake is that getAlbumCustomData() is not a class method but a simple template function. So no global needed.
http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functiongetAlbumCustomData
print $_zp_current_album->getCustomData() would be the class way.

getDesc is a class method, its template equivalent would be getAlbumDesc: http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functiongetAlbumDesc`

Member
Member
tosca   23-08-2013, 15:47
#8

Thanks for the explanation. I've now managed to make work the function without an error.

But I've not still found the best way to manage more than one information for some several albums:

  • either I use the custom data, but I would like to use an array, in order to get something like "width" => 158, "height" => 108; currently I only succeeded in retrieving one single string, so I need to parse it manually I think
  • the other option would be to use the codeblock and assign values to several variables. $width=158; $height=108; does seem to work, but the values are lost after the code block has been executed: they're not there anymore in the page template.

Any suggestion to do this, in a manner that could be simply managed with different values for several albums?

Administrator
Administrator
acrylian   23-08-2013, 16:08
#9

Codeblocks are meant to execute code on the theme dependent on an item. If you need to store values you want to use on the theme page itself you maybe should modify the theme. Codeblocks are executed within a function os it is captured within. You could try to use global variable but then you need to modify the theme to use it anyway.

You can create arrays out of like "158,108" or "158/108) using the php standard function explode.

Member
Member
Papyrus   23-08-2013, 16:40
#10

Normally, if I were to create custom sizes I would modify as needed on the index, album, favorites, and image page to suit my taste.

Reading your comment it seems you want different image sizes depending on which album is called up.

Having seen how to do this in the past, if you do not need a ton of different sizes, the best way to do so is to create variant themes and use the plugin that allows a different theme assignment per album then call the modified page. Can't remember the plugin name right off, sure someone else can contribute it if yoy can't find it.

Member
Member
sbillard   23-08-2013, 17:07
#11

The custom data field may be used to store array information since it stores arbitrary content. A little PHP knowledge is required here, though. You will need to serialize the array before storing it in the custom data field and unserialize it when retrieving it.

Member
Member
sbillard   23-08-2013, 17:11
#12

The plugin @papyrus refers to is the multiple_layouts plugin.

Administrator
Administrator
fretzl   23-08-2013, 17:15
#13

@Papyrus: You mean the multiple_layouts plugin.

Administrator
Administrator
acrylian   23-08-2013, 17:19
#14

Answer shoot out today

Member
Member
tosca   23-08-2013, 18:36
#15

May be some explanations are in order:

  1. I'm working on my own theme, that works for all the photographies (about 90% of the gallery)

  2. for the remaining pictures files, such as postcards, press-book, graphic work and such, I use the multiple-layouts plugin with a custom album page, and a custom image page

  3. I'd rather avoid different custom pages, because of future maintenances; things are too similar from one type of pictures to the other, so I'd rather find some solution using either custom data or code block on specific albums

  4. entering a list of numeric values in the custom data doesn't seem very user-friendly / reliable, that's why I'd like to link each value to either a meaningful label (width, height, and such) or use the code block to assign a value to each variable.

@acrylian: I tried to use global variables, but it didn't work. I probably dit it wrong... can I find somewhere an example of codeblock in that manner?
And by the way, I didn't find the way to switch the language in the admin interface: when I choose English in the general options tab, the interface remains in French!

Administrator
Administrator
acrylian   23-08-2013, 19:06
#16
  1. Ok, maybe the best would be to code the change on the theme switching by the album name. If possible.

  2. I agree but it is the simplest solution probably - especially if you are the only one managing possibly? - without the need of a extra plugin providing extra fields or the like.

Globals and codeblock: We don't have any example I fear. I haven't tried this, it was just a quick idea.

Language: That would mean you don't have an English/US locale on your server. The languages are tied to those available. My live server for example has only English and German, so French would not work (my local MAMP server has them all though). Maybe contact your host if they can set it up. It would just help us if we use the same terms when supporting.

Member
Member
tosca   23-08-2013, 19:41
#17
  1. I can test on the album name. I fact, that's what I had begun with... but I'll need to modify the code each time I'll want to add a new album. And now that I've seen the possibities provided by the album admin page, I'd rather go for a 'cleaner' code.

  2. the simplest thing for putting the gallery on line is not necessarily also the simplest on the long time.
    Yes, I'm the only one managing the gallery, but I'd rather spend as little time as possible tuning code in the future. My main goal is to publish my work on the web, not to manage the gallery. :-)

I'll go on trying some things tomorrow, and will revert to a hard-coded solution if I don't find quickly something more sustainable.

Language: I have no idea what the limits of my hosting service are. And I've recently reinstalled locally a new Linux/Fedora version and didn't take time to set up a new local server; guess I'll do it when my Zenphoto gallery will be public so I have no other option if I want to prepare other modifications!

Administrator
Administrator
acrylian   23-08-2013, 20:16
#18
  1. Sure. An idea would just use some of the fields like location and such if you don't use them otherwise.

  2. Although [i]My main goal is to publish my work on the web, not to manage the gallery. :-)[/i] is a bit related if you self host, isn't it? :-)
    The best from hte user point of view would be a plugin providing extra fields for that specific purpose. However that means some work ;-)

Re: language: We have a script to display available locales: https://github.com/zenphoto/Unsupported/tree/master/misc/list_locales

Member
Member
tosca   23-08-2013, 20:38
#19
  1. If putting on line the Zenphoto gallery had been a priority, it should had been done months ago! As it is, I still make things go with my 'old' Piwigo gallery and my FB page. :-)

I found out the answer for the language: I needed to deactivate the French otherwise it remains the default. Deactivation of the HTTP_AcceptLanguage was not enough apparently.

Member
Member
Papyrus   23-08-2013, 21:13
#20

Ha, thanks everyone for filling in the plugin name. I'd have to say custom codeblocks or functions aren't any simpler than just having one modified line per page that needs modification as you'd run into with the multiple layouts method if you wanted to go that way.

That being said, here is another method that would require a touch more work but could accomplish the goal with one function. What you could do is grab the URI and match against a list of album names (likely at the top level, where you split into postcards, photo books, etc.. so it'd automatically apply to sub-albums) grab that album name, set it as a variable, then run a loop that checks the variable and (if x album, then y dimensions) prints that on the page. A bit more work but only one function to maintain.

Pages (2): 1 2   
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.