ZenphotoCMS Forum
create new custom data fields? - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: create new custom data fields? (/thread-3052.html)



create new custom data fields? - Vaisak - 2008-06-06

I wonder if there's a way to do this, since I've been trying the nightly build with localization plugin and managed to get the description from the custom data field when I change to German (using switch). I think this is quite an easy way to have descriptions in different languages for those who, like me, doesn't know a lot of php.
But the thing is, the way I'm using Paypal integration uses the custom data field too (checking if there's something written, to have individual prices and sizes, or simply nothing), so I cannot use both at the same time. Also, if I wanted a third language, I'd need another one...

Well, I was wondering if I'd have to mess with mysql to do this. Most of the times I can do things when they require php, but I've never edited a database.




create new custom data fields? - sbillard - 2008-06-06

You can always partition your customdata field into parts. Use some character as a part separator that will not appear in any of the items you want to store.

Suppose you use | as your separator. Then you could store
paypal data|someother data|the third set
in the custom data. You would then use the explode() function to separate out each of the fields:
$mycustomdata = explode('|', getCustomData());
then $mycustomdata[0] would have the paypal date, $mycustomdata[1] would have the someother data and $mycustomdata[2] would have the third set.

We really discourage you from hacking the core of zenphoto (which is what you would need to do to create multiple table columns for your extra custom data fields.) Hacking the core makes it hard for you when you want to upgrade and it makes it hard for us to diagnose problems you might someday have.




create new custom data fields? - Vaisak - 2008-06-06

Thanks sbillard, I'm gonna try that asap. I didn't really like the idea of hacking the code, either. Thankfully is just a local installation, so if I mess things up, I won't have any problems XD

By the way, is the spanish localization available for download? I'm interested in giving it a try.

EDIT: It works wonderfully, thanks again, sbillard!




create new custom data fields? - acrylian - 2008-06-07

You find always all available translations here: http://www.zenphoto.org/trac/report/9




create new custom data fields? - special-k - 2010-03-01

When I try this, I get an error "call to undefined function".
What am I doing wrong?

I just did
$custom=getCustomData();




create new custom data fields? - sbillard - 2010-03-01

There are versions of this function based on the object you are using--for instance getAlbumCustomData(). But if you just want to have translatable descriptions, you can do that by enabling the multi-lingual option. Then the description edit will allow you to provide multiple versions for various languages. (If that is not you intent, be careful what thread you hijack.)




create new custom data fields? - special-k - 2010-03-01

Sorry sbillard, didn't realize I updated on a year old thread. (also didn't mean to hijack anything; Just figured I'd post here since it was a similar question).