Anyone know a way to create a link to generate a vCard from a Zoo content?


It would be a pretty involved process and after writing out an outline for it, you might be better off hiring one of the ZOO experts like ZOOlanders, Yoonique, or Herdboy (Mustaq) to write it. I would also post on the YOOtheme support board.

Below is my take on it as a rough idea as a starting place, not an exact solution. Overall, it would change depending on whether you are wanting to display it within an existing ZOO layout like teaser or item, or wanting to display the link outside of ZOO and send variable of which listing to pull.

The easiest would be to do from within ZOO so you already have that particular item data to have the ID. I think you would be putting these pieces together:

1. Create a new layout specific for the vCard following http://yootheme.com/zoo/documentation/developers/create-a-new-template for that specific application and template.
2. In that layout, manually add, setup the vCard format from DevilCode's answer on https://stackoverflow.com/questions/6240375/vcard-propagate-with-info-from-db-via-php
3. Substitute out the array variables he uses with the ZOO code for either ZOO positions (you would have to tinker with how the element is rendered), or by accessing specific elements (probably easier): http://yootheme.com/zoo/documentation/developers/accessing-element-data)
4. Tweak formatting because vCards are finicky. So if multiple instances of an element, make sure separated by semi-colons, etc
5. Find the item.php layout for that specific application, template and type. In it, add code for the vcard link and open up the vcard template in a new window. To do that, I think you would use similar render code from the _items.php file and pass the item ID to pull the correct record. I am not sure on this.
6. To get the file to autosave as an actual vcf file, you might have to use javascript to write as a new file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.