A place for users and developers of the Xataface to discuss and receive support.
by wisni1rr » Thu Feb 23, 2012 12:52 pm
I just watched a video on youtube that had a simple example for having an embedded map. http://youtu.be/HTm-3CduafwI was wondering if anyone could guide me as to how I could have the map display in the Xataface framework. I only need it to show up on 1 table's detail page. I'm not sure on the best placing of the map on the details page of a record. However, the map should be placed logically. (Note: the details page in question already has a PIC as a logo. I'm playing around with it. I figured I would ask in case someone can solve this issue for me in second. Thanks!
-
wisni1rr
-
- Posts: 107
- Joined: Mon Feb 13, 2012 9:03 pm
by wisni1rr » Thu Feb 23, 2012 3:05 pm
Thanks again, Steve! I was wondering now how I could call the fields for the current record as variables. All the fields required to generate an address are in the same table that the delegate class resides. I need theses fields (spelled as variables): - Code: Select all
$StreetNO, $StreetName, $City, $State, $Zip and save them as a new variable - Code: Select all
$locationString = "$StreetNo,+$StreetName,+$City,+$State,+$Zip
So my delegate would be something like this: - Code: Select all
function section__Map(&$record){ return array( 'content' => <iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=<?php echo$locationString?>&ie=UTF8&hq=&hnear=<?php echo $locationString;?>&t=m&z=14&output=embed"></iframe> 'class' => 'main', 'label' => 'Property Map via Google' ); }
-
wisni1rr
-
- Posts: 107
- Joined: Mon Feb 13, 2012 9:03 pm
by shannah » Thu Feb 23, 2012 3:27 pm
- Code: Select all
$locationString = $record->val('StreetNo').','.$record->val('StreetName').','. ... etc....
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by wisni1rr » Thu Feb 23, 2012 3:36 pm
Can I use php on the 'content' array? For example: - Code: Select all
function section__map(&$record){ return array( 'content' => '$record->val("City")', 'class' => 'main', 'label' => 'Property Map via Google' ); }
My content will start off with traditional <html> tags but goes in and out of php a few times.
-
wisni1rr
-
- Posts: 107
- Joined: Mon Feb 13, 2012 9:03 pm
by ADobkin » Thu Feb 23, 2012 3:54 pm
Yes, you can do that, but variables are not parsed inside of single quotes. Either change them to double quotes or remove them altogether, depending on what else you plan on adding to it.
-
ADobkin
-
- Posts: 195
- Joined: Mon Oct 22, 2007 7:31 pm
- Location: Atlanta, GA, USA
by wisni1rr » Thu Feb 23, 2012 4:07 pm
Thank you for pointing that out. I had forgotten that rule...
-
wisni1rr
-
- Posts: 107
- Joined: Mon Feb 13, 2012 9:03 pm
by wisni1rr » Thu Feb 23, 2012 4:24 pm
The content I am using also contains some double quotes... I tried switching the content to use single quotes instead. The application works. However, it behaves unexpectedly. When using double quotes, the details section becomes hidden. If you collapse the map section I have created, it will flicker between expanded and collapsed. The following code works how I would like it to. The problem is it is not dynamic. - Code: Select all
function section__map(&$record){ return array( 'content' => '<iframe width="700" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=528+15TH+ST,+Port+Huron,+MI&aq=&sll=42.827639,-82.633667&sspn=0.80171,1.234589&ie=UTF8&hq=&hnear=528+15th+St,+Port+Huron,+Michigan+48060&ll=42.978434,-82.441678&spn=0.006248,0.009645&t=m&z=16&output=embed"></iframe>', 'class' => 'main', 'label' => 'Property Map via Google' ); }
Removing the quotes all together will generate a Parse error: unexpected '<'.
-
wisni1rr
-
- Posts: 107
- Joined: Mon Feb 13, 2012 9:03 pm
by wisni1rr » Fri Feb 24, 2012 12:11 pm
I figured it out. Here is my solution for anyone who was wondering: - Code: Select all
function section__map(&$record){ $locationString = $record->val('StreetNo').' '.$record->val('StreetName').' '.$record->val('City').' '.$record->val('State'); $locationString = urlencode($locationString); return array( 'content' => "<iframe width='725' height='350' frameborder='1' scrolling='no' marginheight='0' marginwidth='0' src='http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=$locationString&ie=UTF8&hq=&hnear=$locationString&t=m&z=16&iwloc=A&output=embed'></iframe>", 'class' => 'main', 'label' => 'Property Map via Google' ); }
-
wisni1rr
-
- Posts: 107
- Joined: Mon Feb 13, 2012 9:03 pm
Return to Xataface Users
Who is online
Users browsing this forum: No registered users and 4 guests
|