PDA

View Full Version : Question using info from a Field


Loren
06-11-2006, 10:19 PM
Just trying something out, I have created a field called Postcode (zipcode) I want to be able to get the information the user puts in and display it in Mapquest.

I.E. On the View link page i want to put a hyperlink using this code

<a href="http://www.mapquest.co.uk/mq/maps/linkToMap.do?Postcode=SE3&country=GB&cid=lfmaplink">Map This Location</a>

How would i be able to put in the {$link.postcode} shown in red, within the html code like this so when you clicked on the link it would input that info in rather than {$link.postcode} which is what i got.

Sergey Ten
06-11-2006, 10:29 PM
Hello Loren,

Please email me the letter with exact information.

sten at esyndicat dot com

Loren
06-11-2006, 10:36 PM
Hello Sergey

Well here is the link if that's what you mean

http://www.mapquest.co.uk/mq/static/Linktomapquest_maps_en.do

Sergey Ten
06-11-2006, 10:56 PM
Ok Loren,

Please follow directives:

*** Open your view-link.tpl ***
*** Find this code ***


<tr>
<td><strong>{$lang.link_added}:</strong></td>
<td>{$link.date}</td>
</tr>


*** After add this code ***


<tr>
<td><A HREF="http://www.mapquest.co.uk/mq/maps/linkToMap.do?address=100+Broad+Walk&city=London&Postcode={$link.postcode}&country=GB&cid=lfmaplink" target="_blank">Map This Location</A>
</td>
</tr>


*** Save change ***

Loren
06-12-2006, 06:28 AM
Thank You Sergey for this..and heres the but, that is exactly what i did. It doesnt work, it's the most logical thing to do.

Why, firstly this link does not show at all in the view-link.tpl page when called. Have no idea why.

If i preview the link while editing, and click on link what happens is MapQuest's link page pops up, the Mapquest form displays the Postcode field, with {$link.postcode} rather than the actual information, and there is an error of course saying can't find it.

Oh well am looking into how you could use PHP with this blasted thing..:fool: I hate smarty some times :(

Loren
06-12-2006, 08:16 AM
Okay this is what i have managed and if anyone is interested in putting a link to a map using info created in a field called postcode/zipcode, it will display that info in this form, which i have personally cut down to just the postcode and the button for my own purposes, but if you want the whole one here it is.

<!-- MapQuest Start -->
</FORM>
<form action="http://www.mapquest.co.uk/mq/maps/linkToMap.do" method="post">
<input type="hidden" name="CID" value="lfmapwid">
</form></TD>
<TD width="50%">
<FORM action="http://www.mapquest.co.uk/mq/maps/linkToMap.do" method=post name=linktomap>
<DIV align=center>
<TABLE style="FONT: 11px Arial,Helvetica" cellSpacing=0
cellPadding=3 border=0>
<TBODY>
<TR>

<TD colSpan=2>
<DIV align=center><a href="http://www.mapquest.co.uk/mq/home.do">
<img border="0" src="http://cdn.mapquest.com/mqstyleguide/ws_wt_sm" alt="MapQuest"></A></DIV></TD></TR>
<TR>
<TD colSpan=2>Address/Junction:</TD></TR>
<TR>
<TD colSpan=2><INPUT maxLength=80 name=address> </TD></TR>
<TR>
<TD colSpan=2>Location:</TD></TR>

<TR>
<TD colSpan=2>
<INPUT type="text" maxLength=80 name=city value="{$link.location}" size="20"> </TD></TR>
<TR>

<TD>Post Code:</TD></TR>
<TR>

<TD>
<input type="text" maxLength=12 size=10 name=Postcode value="{$link.postcode}"> </TD></TR>

<TR>
<TD colSpan=2>Country:</TD></TR>
<TR>
<TD colSpan=2><SELECT name=country>
<option value=AT > Austria </option>

<option value=BE > Belgium </option>

<option value=DK > Denmark </option>

<option value=FR > France </option>

<option value=DE > Germany </option>

<option value=IT > Italy </option>

<option value=LU > Luxembourg </option>

<option value=NL > Netherlands </option>

<option value=ES > Spain </option>

<option value=SE > Sweden </option>

<option value=CH > Switzerland </option>

<option value="GB" selected>United Kingdom</option>

</SELECT> </TD>
</TR>
<TR>

<TD style="TEXT-ALIGN: center" colSpan=2><INPUT type=submit value="Get Map">
</TD></TR></TBODY></TABLE></DIV></FORM><!-- MapQuest End -->

Of course the above is for UK and Europe Only. For US (other parts of world maybe available you will have to look) use this one here http://www.mapquest.com/features/main.adp?page=lf_findit and you maybe able to change the option codes to make a drop down of your choice. But that might be fiddly.

Lastly if you want to change the country which is displayed first in my case UK. Which is like this:

<option value="GB" selected> United Kingdom</option>

If i wanted France to be highlighted first i would change:

<option value=FR >France</option> to:

<option value="FR" selected>France</option>

One last tip..i couldn't get the code on the MapQuest Site to work straight off, in fact all it displayed was the country. The Above is the result of fiddling with their source code of their demo and their code to put in your page, so bare that in mind if you don't get it to work for the US one.

Cris Santos
06-12-2006, 07:03 PM
Loren - this is pure gold.
I am going to give this a right fiddle this weekend and if i get this to work, i'll start by jumping up and down on the same spot for a few moments. Then i'll send you a love letter, and then i'll do some more jumping...!

Love
Cris!

Loren
06-12-2006, 08:11 PM
:ooi: Gosh!
I hope you will be able to :good:always nice to go a little barmy when something works :)