<![CDATA[ Support/Comments for vCard - My Forums]]> https://forums.modx.com/thread/?thread=48854 <![CDATA[Re: Support/Comments for vCard]]> https://forums.modx.com/thread/48854/support-comments-for-vcard?page=2#dis-post-283994 http://f3internet.com/articles/2010/06/22/creating-an-hcard-vcard-directory-in-modx/]]> [email protected] Jun 25, 2010, 04:05 AM https://forums.modx.com/thread/48854/support-comments-for-vcard?page=2#dis-post-283994 <![CDATA[Re: Support/Comments for vCard]]> https://forums.modx.com/thread/48854/support-comments-for-vcard?page=2#dis-post-283993
e.g.
[~60~]?person=[+id+]]]>
ncrossland Jun 25, 2010, 03:04 AM https://forums.modx.com/thread/48854/support-comments-for-vcard?page=2#dis-post-283993
<![CDATA[Re: Support/Comments for vCard]]> https://forums.modx.com/thread/48854/support-comments-for-vcard#dis-post-283992 Quote from: ncrossland at Jun 24, 2010, 07:57 AM

Are you linking to the page containing the vCard snippet with the ID of the person whose card you want to display?
e.g.
/path/to/vcard?person=5

Thanks for replying so quickly smiley! I’m just linking to the vcard from a template:

<a href="[~60~]">Download vCard</a></li>


Do I need to attach ?person= to this, e.g. <a href="[~60~]?person=10">Download vCard</a></li> ? (I tried this but got a 404 error but my syntax may be incorrect).]]>
hsteel Jun 25, 2010, 12:55 AM https://forums.modx.com/thread/48854/support-comments-for-vcard#dis-post-283992
<![CDATA[Re: Support/Comments for vCard]]> https://forums.modx.com/thread/48854/support-comments-for-vcard#dis-post-283991
e.g.

/path/to/vcard?person=5

]]>
ncrossland Jun 24, 2010, 02:57 AM https://forums.modx.com/thread/48854/support-comments-for-vcard#dis-post-283991
<![CDATA[Re: Support/Comments for vCard]]> https://forums.modx.com/thread/48854/support-comments-for-vcard#dis-post-283990 Much appreciated!

I am currently trying to use it for a new MODx (Evolution) site, and while it generates the vCard fine it’s not filling the fields with the template variables I’ve assigned.

I’ve created a new page in the menu structure called ’vCard template’ which contains the following code:
[[vCard? &name=`*full-name*` &email=`*contact*` &organisation=`Camerons Accountants and Advisors` &address_street=`` &address_region=`Tasmania` &address_city=`*office*` &postcode=`` &url=`http://www.camerons-ca.com.au/` &urlParam=`person` ]]


Then on each staff profile page I’ve included a link to this page ID. When clicked it generates an eCard in Outlook but none of the dynamic fields are populated (only those which are hard-coded, e.g. the url, show up).

I thought this may have something to do with the &urlParam=`person` value? I tried to figure this out by reading the documentation, specifically "...tell the snippet which member of staff we wanted a vCard for by supplying their doc ID as a URL paramater called "person".", but couldn’t work it out sorry.

Any help you can give me would be very gratefully received! And thanks again for providing this snippet smiley

Thanks
Harmony
]]>
hsteel Jun 23, 2010, 11:10 PM https://forums.modx.com/thread/48854/support-comments-for-vcard#dis-post-283990
<![CDATA[Re: Support/Comments for vCard]]> https://forums.modx.com/thread/48854/support-comments-for-vcard#dis-post-283989 ncrossland Apr 16, 2010, 10:13 AM https://forums.modx.com/thread/48854/support-comments-for-vcard#dis-post-283989 <![CDATA[Re: Support/Comments for vCard]]> https://forums.modx.com/thread/48854/support-comments-for-vcard#dis-post-283988
97,98c97,98
< 		if (substr($input[$f], 0, 7) == 'parent.') {
< 			$tvname = substr($input[$f], 7);
---
> 		if (substr($tvname, 0, 7) == 'parent.') {
> 			$tvname = substr($tvname, 7);

]]>
[email protected] Apr 15, 2010, 11:16 AM https://forums.modx.com/thread/48854/support-comments-for-vcard#dis-post-283988
<![CDATA[Re: Support/Comments for vCard]]> https://forums.modx.com/thread/48854/support-comments-for-vcard#dis-post-283987
While it’s awaiting approval in the repository, I’ve attached it here.]]>
ncrossland Apr 06, 2010, 10:13 AM https://forums.modx.com/thread/48854/support-comments-for-vcard#dis-post-283987
<![CDATA[Re: Support/Comments for vCard]]> https://forums.modx.com/thread/48854/support-comments-for-vcard#dis-post-283986
I’ve made a couple of very minor changes, necessary to allow me to use TVs on the current document without having to specify the doc ID.

Currently, your code A) sets the id to false if a non numerical urlParam is provided and B) requires the id in order to look for the * characters that indicate a TV is to be sourced.

There’s no need for B because MODx will default to using the current document id if it’s false and I think the preventing A results in behaviour that’s least surprising (in that one bad param won’t alter another good one).

Changes made to repo-1498.txt.

diff --git a/HEAD^:vCard.snippet.php b/HEAD:vCard.snippet.php
index 34b1250..ff321be 100644
--- a/HEAD^:vCard.snippet.php
+++ b/HEAD:vCard.snippet.php
@@ -77,8 +77,6 @@ $id = isset($id) ? $id : false;
 $urlParam = isset($urlParam) ? $urlParam : 'id';
 if (isset($_GET[$urlParam]) && is_numeric($_GET[$urlParam])) {
        $id = $_GET[$urlParam];
-} else {
-       $id = false;
 }
 
 
@@ -92,7 +90,7 @@ foreach ($fields as $f) {
        $input[$f] = isset($$f) ? $$f : '';
        // If the value supplied is surrounded by *, e,g, *staffemail*, assume we are being told to use not a literal value here, 
        // but the value of a template variable
-       if ($id && substr($input[$f], 0, 1) == '*' && substr($input[$f], -1, 1) == '*') {
+       if (substr($input[$f], 0, 1) == '*' && substr($input[$f], -1, 1) == '*') {
                $tvname = substr($input[$f], 1, strlen($input[$f])-2);  // remove the asterisk from each end
                $doc_id = $id;
                // if we have requested a parent TV value by prefixing the tv name with parent.
@@ -316,4 +314,4 @@ class vCard {
                return $this->filename;
        }
 }
-?>
\ No newline at end of file
+?>


Thanks again.

Stephan]]>
[email protected] Mar 30, 2010, 04:58 PM https://forums.modx.com/thread/48854/support-comments-for-vcard#dis-post-283986
<![CDATA[Re: Support/Comments for vCard - doesn't work with utf-8]]> https://forums.modx.com/thread/48854/support-comments-for-vcard#dis-post-283985 Around line 90 I had to change
foreach ($fields as $f) {
	$input[$f] = isset($$f) ? $$f : '';

into
foreach ($fields as $f) {
	$input[$f] = isset($$f) ? utf8_decode($$f) : '';

I’m not sure if this is the ultimate solution, but it works for me.
regards
manu]]>
manu37 Oct 14, 2008, 07:46 AM https://forums.modx.com/thread/48854/support-comments-for-vcard#dis-post-283985