15 Replies Latest reply on Jun 25, 2006 2:49 PM by resselite

    Linking to various URLs and a dynamic link

    resselite
      Hello,

      I have an Access DataBase with a number of fields, and one of them is titled 'url' where all the fields are populated with an htp address, for example http://www.google.com.

      Now, how do I bring that over to my CFMX page like all other material in the DataBase where it holds the specific record ID as well as launches an internet browser window with that specific url?

      Please hlep,
      I am lost.
      Thank you.

      staricco@vzavenue.net
        • 1. Re: Linking to various URLs and a dynamic link
          Abram Adams Level 1
          Huh? Are you wanting to output the url as a link that opens in a new window?
          <cfquery name="myquery"...>
          select recordID,url, otherfield,otherfield from mytable
          </cfquery>
          <cfoutput query="myquery">
          #recordID# <a href="#myquery.url#" target="_blank">#otherfield#</a><br />
          </cfoutput>

          or are you trying to make a dynamic pop-up when the page loads?(pop-ups = bad)
          • 2. Re: Linking to various URLs and a dynamic link
            resselite Level 1
            Hello SolutionFinder,

            sounds to me like it is your first choice, . . "a url link that opens a new window".

            Again, the database has let's say two fields, 'image' and 'domain'.
            On one dynamic page you get a list of all the images, and each one of them is a link to open a corresponding url address in a new window.

            Hope that is beginning to make more sense.
            • 3. Re: Linking to various URLs and a dynamic link
              Abram Adams Level 1
              Then it would be something like this:

              <cfquery name="myquery"...>
              select image,domain from mytable
              </cfquery>
              <cfoutput query="myquery">
              <a href="#myquery.domain#" target="_blank"><img src="#image#" border="0"></a><br />
              </cfoutput>
              • 4. Re: Linking to various URLs and a dynamic link
                resselite Level 1
                Hello again,

                well that is not working 100%. I DO SEE THOUGH the correct url address in the address bar, but the new window that opened up simply displays what was in the original window. In other words, the original window has a logo of Yahoo, and when you click on it, it opens a new window, but still with the logo of Yahoo, . . although at the end of the address bar you notice

                . . . . . . . . . . . . recordID=1# http://www.yahoo.com

                So what is up with that? Don't understand. Shouldn't it have read the field url titled "domain" from the database as a hyperlink and actually gone to http://www.yahoo.com instead of tacking that on to the end of the line in the browser's address field?

                Help please.
                • 5. Re: Linking to various URLs and a dynamic link
                  Abram Adams Level 1
                  Post your code so that we can determine what's going on.
                  • 6. Re: Linking to various URLs and a dynamic link
                    resselite Level 1
                    Hello again,

                    alright here is the architecture.

                    A main page displays a repeat region recordset from an Access Database. This record set is displayed as a vertical list of images. These images are links to a detail window that shows a larger version of the image you click as well as some information pertaining to that image. The detail window also has a LAUNCH button where if applicable, you can press that link and it should take you to the url specific to the content you are viewing in that details page.

                    Main Page Code:

                    <cfquery name="ressINTER" datasource="ressDBhyperlinks">
                    SELECT id, preview FROM archivesInter ORDER BY "year" DESC
                    </cfquery>

                    <html>
                    <head>
                    <title>RessELITE</title>

                    <SCRIPT LANGUAGE="JavaScript">
                    function Lvl_openWin(u,n,w,h,l,t,c,f) { //v2.2 4LevelWebs
                    var x=((screen.width-w)/2);if(c==1){l=x;t=(screen.height-h)/2;}if(c==2){l=x}
                    f+=',top='+t+',left='+l;LvlWin=window.open(u,n,f);LvlWin.focus();
                    }
                    </SCRIPT>

                    </head>
                    <!-- background-color:transparent; -->
                    <body bgcolor="#85582C" text="#333333" link="#4A4A4A" leftmargin="0" topmargin="0" STYLE="background-color:transparent;overflow-x:hidden;overflow-y:scroll">

                    <cfoutput query="ressINTER">
                    <p><a href="javascript:Lvl_openWin('projectINTER.cfm?recordID=#ressINTER.id#','project','640',' 480','0','0','1','width=640,height=480')""><img style="FILTER: alpha(opacity=40)" onmouseover=nereidFade(this,100,40,10) onmouseout=nereidFade(this,40,20,10) src="#ressINTER.preview#" border="0"></a>
                    </p>
                    </cfoutput>

                    <p> </p>
                    </body>
                    </html>
                    <%
                    ressINTER.Close()
                    Set ressINTER = Nothing
                    %>

                    DETAIL PAGE CODE

                    <CFQUERY name="ressCONTENT" datasource="ressDBhyperlinks">
                    SELECT * FROM archivesINTER WHERE ID = #URL.recordID#
                    </CFQUERY>

                    <html>
                    <head>
                    <title>RessELITE</title>
                    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

                    <SCRIPT LANGUAGE="JavaScript">
                    function Lvl_openWin(u,n,w,h,l,t,c,f) { //v2.2 4LevelWebs
                    var x=((screen.width-w)/2);if(c==1){l=x;t=(screen.height-h)/2;}if(c==2){l=x}
                    f+=',top='+t+',left='+l;LvlWin=window.open(u,n,f);LvlWin.focus();
                    }
                    </SCRIPT>

                    </head>

                    <body bgcolor="#1E1E1E" text="#FFFFFF" link="#D2A800" vlink="#D2A800" alink="#D2A800" leftmargin="0" topmargin="0" style="overflow-x:hidden;overflow-y:hidden;" onBlur="window.focus()">
                    <table width="640" height="480" border="0" cellpadding="0" cellspacing="0" background="../images/projectbckgrd.jpg">
                    <tr>
                    <td width="235" height="55" background="../images/projectresslogo.jpg">  </td>
                    <td width="270" height="55">
                    <table width="269" height="55" border="0" cellpadding="0" cellspacing="0" background="../images/projectinfo.jpg">
                    <tr>
                    <td height="24" align="right" valign="bottom"><strong><cfoutput>#ressCONTENT.client#</cfoutput>
                    </strong></td>
                    </tr>
                    <tr>
                    <td height="31" align="right" valign="bottom"><em><cfoutput>#ressCONTENT.title#</cfoutput>
                    </em></td>
                    </tr>
                    </table></td>
                    <td width="135" height="480" rowspan="2"><img src="../images/projectbar.jpg" width="135" height="480" border="0" usemap="#interCLOSE"></td>
                    </tr>
                    <tr>
                    <td width="505" height="425" colspan="2" align="right" valign="top"><img src="<cfoutput>#ressCONTENT.content#</cfoutput>"><br>
                    <font size="2">[<cfoutput>#ressCONTENT.year#</cfoutput>] - <cfoutput>#ressCONTENT.tools#</cfout put> - <cfoutput query="ressCONTENT"><A HREF="#ressCONTENT.domain#" target="_blank"><font face="Arial, Helvetica, sans-serif"><strong>LAUNCH</strong></font></A></font></cfoutput>
                    </td>
                    </tr>
                    </table>
                    <map name="interCLOSE">
                    <area shape="rect" coords="53,441,126,470" href="javascript:window.close();">
                    </map>
                    </body>
                    </html>
                    • 7. Re: Linking to various URLs and a dynamic link
                      Abram Adams Level 1
                      resselite,
                      First of all, what does the data look like? Does #ressCONTENT.domain# always start with " http://"? It sounds like it doesn't. If your url looks like this <a href="www.yahoo.com">....</a> (missing http) the browser will think it is a relative url and look for a page called www.yahoo.com on your site under to the current directory. So, if you are at http://www.mysite.com?recordID=1, then you clicked the link without http:// you will be taken to http://www.mysite.com/www.yahoo.com.

                      Also, it looks like you have some asp code:
                      <%
                      ressINTER.Close()
                      Set ressINTER = Nothing
                      %>
                      What's that for? This is a .cfm page... right?

                      • 8. Re: Linking to various URLs and a dynamic link
                        resselite Level 1
                        Hello,

                        that last bit of ASP code is old, my mistake when I cut and paste it over to this forum; just ignore.

                        As for how my data looks:

                        Table with three columns.
                        Column One titled 'id'
                        Column Two titled 'image' (looks like the following example - graphics/image1.jpg) and (graphics/image2.jpg) and so on.
                        Column Three titled 'domain' ( looks like the following example - http://www.yahoo.com

                        When I created the table in the database, you know how you add a field and select what type it is? For example, text, memo, number, date&time?? Well for the id field I selected obviously AutoNumber, for the image I selected text, and for the domain field I assumed it was hyperlink.

                        Hope that stuff helps.
                        • 9. Re: Linking to various URLs and a dynamic link
                          Abram Adams Level 1
                          Just so I'm on the same page, it's the details page that is not properly building the link (the LAUNCH link) right?

                          Could you do a <cfdump var="#ressCONTENT#"> and post it here? Also, do you have a public viewable url that I could take a look at?
                          • 10. Re: Linking to various URLs and a dynamic link
                            resselite Level 1
                            Hello,

                            sorry I took a while to get back to you. Yes it is the details page. The LAUNCH button. As for a live example, I will try to post something up tonight and you can see what happens. If I get a copy over to a URL I'll update this last post.

                            Thanks.
                            • 11. Re: Linking to various URLs and a dynamic link
                              resselite Level 1
                              Hello again, not sure what you mean by posting a <cfdump var="#ressCONTENT#">. Is this something that could help you figure out what is wrong with the url link? If so, explain and I'll try to do it for you.
                              • 12. Re: Linking to various URLs and a dynamic link
                                Abram Adams Level 1
                                That cfdump tag will dump the contents of your query to the screen. You can just save a printscreen from that and post the url, or you could do the dump on the example url you are creating. This will give us a look at the bigger picture.
                                • 13. Re: Linking to various URLs and a dynamic link
                                  resselite Level 1
                                  Hello,

                                  ooohh, good to know. I can defintely learn how to use that. But I was able to get something better to help. I set up a working verison of my problem (with the error of course) that you can access and download a zipped file to work with on your own pc. Here is the link.

                                  http://www.resselite.net/TEST.zip

                                  Very simple setup, just a dinky little database, two pages, one is called main the second is details.

                                  This should really help you see what is going on.
                                  Thanks in advance.
                                  • 14. Re: Linking to various URLs and a dynamic link
                                    Abram Adams Level 1
                                    Much clearer now. It's the datatype you chose for the "domain" column. Access has a silly way of doing things, and usually tries not to show you what the real data looks like. When you have a "hyperlink" data type, in access the data looks like: http://www.google.com, however if you cfdump it to the screen you'll notice it looks like # http://www.google.com#.

                                    So on your LAUNCH links, the browser looks at the # and thinks it's an bookmark/anchor link. and looks for an anchor on the current page named " http://www.google.com".

                                    Solution 1 (better one):
                                    Change the datatype to text and removes the #'s from the data. This should do the trick.

                                    Solution 2 (only if you HAVE to use hyperlink datatype)
                                    When building the link use rereplace to get rid of the #'s (<a href="#ReReplaceNoCase(content.domain,'##','','All')#"....)


                                    • 15. Re: Linking to various URLs and a dynamic link
                                      resselite Level 1
                                      YES!!! Great it works, and now I've learned something else. Thanks a lot. Greatly appreciated. I'm happy to see the zipped file I sent helped clear things up.

                                      One thing I am curious about. After setting up the code the way you suggested and having it work, how can you modify the href link so that the window being opened is centered? I have the main page open up the details page centered, but that is with a different setup on my href link. The new href link that you showed me how to do is simply href="#blah.blah#" is there a way to add some attributed to that or somehow use the same javascript that I use in the main page?

                                      Thanks again.