|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
URL Structure
Author: Casey Dougall
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#240202
You can replace url's on the fly, or resave it to the database with the
following...
You can also put a <cfloop> around the whole thing and do it for every
record in the database
<!--- GET ALL PAGES WITH BAD URLS FROM DATABASE --->
<CFQUERY Name="SetURL" datasource="#Application.Datasource#">
SELECT PageDataField FROM tbl_gallery
WHERE ID =
<cfqueryparam cfsqltype="cf_sql_integer" value="1" maxlength="4">
</CFQUERY>
<!--- OK - SET THE NEW URLs WHERE NEEDED--->
<CFSET newPageContent = #ReplaceNoCase(SetURL.PageDataField,"<a
href=""http://" , "<a href=""http://phat-links.com/page.cfm?goto=","ALL")#>
<!--- UPDATE DATABASE RECORD TO REFERENCE NEW URL --->
<cfoutput> #newPageContent# </cfoutput>
Author: Mark A Kruger
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#240164
Tuan,
I believe the suggestion I made earlier would work for you.
-mark
I do already have a disclaimer page. Lets say I have a page called
content.cfm and a page called disclaimer.cfm. The user will use a CMS tool
to write the content for the content.cfm page. They have no control over
the layout of the page (headers, navigation, footers, or anything like
that). Using this tool, the user creates the content and creates any links.
The user does NOT see any HTML at all. The CMS tool does everything for the
user.
Now when a user creates a link in content.cfm they prefix any link with
http://mysitename.com/disclaimer.cfm?destination=
For example a link a user might enter into the CMS tool might look like:
http://mysitename.com/disclaimer.cfm?destination=http://someurlhere.com/disc
laimer.cfm?destination=http://go.reuters.com/newsArticle.jhtml?type=healthNe
ws&storyID=12037965&src=eDialog/GetContent
So the disclaimer page is displayed first before redirecting the user to the
intended link.
What my disclaimer.cfm page does now is extracts the value from the
destination url variable and a javascript then redirects the page to that
value. But it doesn't work when there are multiple URL parameters in the
destination URL, like in the Reuter link above.
I'm trying to find a solution that would allow the disclaimer.cfm page to do
all the work of extracting and creating the redirect link correctly without
having the user do anything different on the content.cfm page.
I hope this clears up my problem. I really don't know how else to explain
it.
----- Excess quoted text cut - see Original Post for more -----
----- Excess quoted text cut - see Original Post for more -----
Author: Tuan Tran
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#240143
I do already have a disclaimer page. Lets say I have a page called content.cfm
and a page called disclaimer.cfm. The user will use a CMS tool to write the
content for the content.cfm page. They have no control over the layout of the
page (headers, navigation, footers, or anything like that). Using this tool, the
user creates the content and creates any links. The user does NOT see any HTML
at all. The CMS tool does everything for the user.
Now when a user creates a link in content.cfm they prefix any link with http://mysitename.com/disclaimer.cfm?destination=
For example a link a user might enter into the CMS tool might look like:
http://mysitename.com/disclaimer.cfm?destination=http://someurlhere.com/disclaimer.cfm?destination=http://go.reuters.com/newsArticle.jhtml?type=healthNews&storyID=12037965&src=eDialog/GetContent
So the disclaimer page is displayed first before redirecting the user to the
intended link.
What my disclaimer.cfm page does now is extracts the value from the destination
url variable and a javascript then redirects the page to that value. But it
doesn't work when there are multiple URL parameters in the destination URL, like
in the Reuter link above.
I'm trying to find a solution that would allow the disclaimer.cfm page to do all
the work of extracting and creating the redirect link correctly without having
the user do anything different on the content.cfm page.
I hope this clears up my problem. I really don't know how else to explain it.
----- Excess quoted text cut - see Original Post for more -----
----- Excess quoted text cut - see Original Post for more -----
Author: Ian Skinner
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#240137
Now that is rather interesting. I can see some use for that behavior.
--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
---------
| 1 | |
--------- Binary Soduko
| | |
---------
"C code. C code run. Run code run. Please!"
- Cynthia Dunning
Confidentiality Notice: This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.
Author: Snake
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#240117
That is def v cool mark, I had never even thought of doing that :-)
Tuan,
I'm not sure what you are trying to do, but here's a trick that allows you
to manipulate links after the facts, as long as they are inside of "<a/>
tags.
Let's say your user put in "<a href="http://blah.com?name=joe J. Smith">Joe
J. Smith</a>. What you want to appear is actually
<a href="http://blah.cfm?nameJoe%20J%2E%20Smith">Joe J. Smith</a>
But you do not want the user to encode it him or herself and you do not what
to allow them to do something like "#urlencodedformat("joe j. smith")#"
Here's a simple way to do that.
On the page that is being served (presumably a CFM Page). Add the following:
<cfimport taglib="htm" prefix=""/>
Then, create a folder called "htm" that branches from that same directory
(where the page is being served). Inside that folder place a file titled
"a.cfm" that can rewrite it for you. The result is that CF treats a call to
<a> as if it were a call to the custom tags. The interior attributes become
attributes of the tag. You could even enforce a URL handler to track clicks
or whatever. You could do the same with the "<form> tag, <div> tag..
Whatever....
I have a good sample on my blog:
http://mkruger.cfwebtools.com/index.cfm/2006/5/10/adaptive.tags
Author: Ian Skinner
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#240111
So I'm basically trying to find a way to have the disclaimer page extract the
complete URL from the referring page (which is the page the content editor
makes).
Do you have this disclaimer page? Or are you asking how to substitute a
disclaimer page when a user clicks on a link in content made by your CMS?
I understood from your first post, that you had the disclaimer page working, but
that when users clicked on the link in it, the did not get to some pages properly
if the relocation link had url parameters. Is this correct? Do you have a page
that makes these links for you?
http://someurlhere.com/disclaimer.cfm?destination=http://go.reuters.com/newsArticle.jhtml?type=healthNews&storyID=12037965&src=eDialog/GetContent
Or are you asking for help on how to create these kinds of links in the first
place.
--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
---------
| 1 | |
--------- Binary Soduko
| | |
---------
"C code. C code run. Run code run. Please!"
- Cynthia Dunning
Confidentiality Notice: This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.
Author: Mark A Kruger
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#240108
Tuan,
I'm not sure what you are trying to do, but here's a trick that allows you
to manipulate links after the facts, as long as they are inside of "<a/>
tags.
Let's say your user put in "<a href="http://blah.com?name=joe J. Smith">Joe
J. Smith</a>. What you want to appear is actually
<a href="http://blah.cfm?nameJoe%20J%2E%20Smith">Joe J. Smith</a>
But you do not want the user to encode it him or herself and you do not what
to allow them to do something like "#urlencodedformat("joe j. smith")#"
Here's a simple way to do that.
On the page that is being served (presumably a CFM Page). Add the following:
<cfimport taglib="htm" prefix=""/>
Then, create a folder called "htm" that branches from that same directory
(where the page is being served). Inside that folder place a file titled
"a.cfm" that can rewrite it for you. The result is that CF treats a call to
<a> as if it were a call to the custom tags. The interior attributes become
attributes of the tag. You could even enforce a URL handler to track clicks
or whatever. You could do the same with the "<form> tag, <div> tag..
Whatever....
I have a good sample on my blog:
http://mkruger.cfwebtools.com/index.cfm/2006/5/10/adaptive.tags
Author: Tuan Tran
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#240092
Yes, the user can view the source code which would take them out of WYSIWYG mode.
Then they would have to sniff thru all the HTML to find the link and wrap it w/
coldfusion code before they save the document. This is precisely something I
don't want them to do because they are not developers, just content editors with
no web knowledge.
Now instead of them wrapping the link w/ coldfusion code I could probably do it
after they save the document. But that would involve me opening up the database
where the content is stored, finding the document and then the link and wrapping
it myself. The problem with this is the extra work for me and the need for the
content editor to contact me whenever a link such as this exist.
So I'm basically trying to find a way to have the disclaimer page extract the
complete URL from the referring page (which is the page the content editor
makes).
Anybody got a solution?
----- Excess quoted text cut - see Original Post for more -----
----- Excess quoted text cut - see Original Post for more -----
Author: Ian Skinner
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#239944
The users simply uses the CMS tool and clicks on the "create hyperlink" button
and copys and paste the link in the field. The user never sees any html.
What happens after the field is submitted? I would presume that there would be
an opportunity to wrap the submitted field in an urlencodedformat() function on
the action of the field, or when the field is being fed back out to be clicked
on.
--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
---------
| 1 | |
--------- Binary Soduko
| | |
---------
"C code. C code run. Run code run. Please!"
- Cynthia Dunning
Confidentiality Notice: This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.
Author: Tuan Tran
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#239908
The users simply uses the CMS tool and clicks on the "create hyperlink" button
and copys and paste the link in the field. The user never sees any html.
----- Excess quoted text cut - see Original Post for more -----
----- Excess quoted text cut - see Original Post for more -----
Author: Ian Skinner
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#239850
The problem I have with this is I'm not the one putting these links on the page.
There are users who uses a content management system that enters in the content
for the website. I want to avoid making the users use ColdFusion code b/c they
don't understand it and it will complicate things for them. I wanted to this in
such a way that all the ColdFusion code is on the disclaimer page (which I
control) and the referring page (content page w/ the link) is just plain html
that is written for them thru the content management system they use. Is there
another way of doing this? Thanks for your help though.
----- Excess quoted text cut - see Original Post for more -----
jhtml> ?type=healthNews&storyID=12037965&src=eDialog/GetContent')#">Test
jhtml> </a>
> </cfoutput>
I do not clearly understand your requirements. How is the sample link being
built?
<quote>
For instance lets say a user clicked on a link on my page that went to:
http://go.reuters.com/newsArticle.jhtml?type=healthNews&storyID=12037965&src=eDialog/GetContent
My page would actually have this as the link http://someurlhere.com/disclaimer.cfm?destination=http://go.reuters.com/newsArticle.jhtml?type=healthNews&storyID=12037965&src=eDialog/GetContent
</quote.
How is the actual link built in your example? I'm assuming this is built on some
cfm page, if so you just need to wrap the first link in a urlEncodedFunction()
when you make the second link.
If this is not possible, you could treat the entire link as a list delimitated by
the question mark ('?'). The first element of the list is your url, the second
element would be your url parameters and the third element would be the url
parameters of the second link.
Does that make sense?
--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
---------
| 1 | |
--------- Binary Soduko
| | |
---------
"C code. C code run. Run code run. Please!"
- Cynthia Dunning
Confidentiality Notice: This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.
Author: Tuan Tran
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#239846
The problem I have with this is I'm not the one putting these links on the page.
There are users who uses a content managment system that enters in the content
for the website. I want to avoid making the users use Coldfusion code b/c they
don't understand it and it will complicate things for them. I wanted to this in
such a way that all the coldfusion code is on the disclaimer page (which I
control) and the referring page (content page w/ the link) is just plain html
that is written for them thru the content managment system they use. Is there
another way of doing this? Thanks for your help though.
----- Excess quoted text cut - see Original Post for more -----
jhtml>
?type=healthNews&storyID=12037965&src=eDialog/GetContent')#">Test</a>
----- Excess quoted text cut - see Original Post for more -----
----- Excess quoted text cut - see Original Post for more -----
Author: Ian Skinner
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#239710
Ok, this is what you want to do. I ran this test code and I get all your second
level url variables.
<cfdump var="#url#">
<cfoutput>
<a href="http:url.cfm?destination=#urlEncodedFormat('http://go.reuters.com/newsArticle.jhtml?type=healthNews&storyID=12037965&src=eDialog/GetContent')#">Test</a>
</cfoutput>
--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
---------
| 1 | |
--------- Binary Soduko
| | |
---------
"C code. C code run. Run code run. Please!"
- Cynthia Dunning
Confidentiality Notice: This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.
Author: Jose Diaz
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#239687
Hi Tuan
Maybe something like this would help,
<cfset ourString = "Src=blahblah&storyID=1234&Yahoo=hello">
<cfloop list=#ourString# index="i" delimiters="&">
<cfset ourString2 = #i#>
<cfoutput>#i#</cfoutput></br>
<cfloop list=#ourString2# index="i2" delimiters="=">
<cfoutput>#i2#</cfoutput></br>
</cfloop>
<hr>
</br>
</cfloop>
This is only rough but im sure you get the jist, obviously you would need to
pretty it up and the var set would be your query string instead, i mean
there are numerous paths you could take, this was the route I initially
thought of.
Hope it helps
Jose
----- Excess quoted text cut - see Original Post for more -----
Author: Ian Skinner
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#239650
My page would actually have this as the link http://someurlhere.com/disclaimer.cfm?destination=http://go.reuters.com/newsArticle.jhtml?type=healthNews&storyID=12037965&src=eDialog/GetContent
The suspect the trouble is the second '?' character. It should not be allowed.
The simplest solution, but untried, would be to urlencode() your destination
value so that these special characters are escaped. You can then urlDecode() the
value in your redirection page to get the folks to where they are supposed to go.
--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
---------
| 1 | |
--------- Binary Soduko
| | |
---------
"C code. C code run. Run code run. Please!"
- Cynthia Dunning
Confidentiality Notice: This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.
Author: Tuan Tran
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#239643
I'm actually creating a disclaimer page that redirects the users. So the user
sees a disclaimer page indicating they are leaving the site and connecting to an
outside site. Then they get redirected to that site. For some reason my
disclaimer redirect code wasn't working correctly for links that had multiple url
variables in it. It would get cut off after the end of thefirst url variable.
The user wouldn't get redirected to the page intended b/c of this. For instance
lets say a user clicked on a link on my page that went to:
http://go.reuters.com/newsArticle.jhtml?type=healthNews&storyID=12037965&src=eDialog/GetContent
My page would actually have this as the link http://someurlhere.com/disclaimer.cfm?destination=http://go.reuters.com/newsArticle.jhtml?type=healthNews&storyID=12037965&src=eDialog/GetContent
the disclaimer.cfm would look something like this:
<cfset destination=url.destination>
<script language="JavaScript" type="text/javascript">
<!--
function dspDisclaim(){
setTimeout('window.location.href="#destination#"',10000);
}
//-->
</script>
Now this worked fine when there wasn't multiple url vars in the original link,
but as you can see this reuter link has mutliple vars in it.
So to fix it so that all the url vars got included in my redirect i did this:
<cfset destination="">
<cfif StructCount(url) GT 1>
<cfset destination = url.destination>
<cfset structDestinationRemove = StructDelete(url, "destination", "true")>
<cfloop collection=#url# item="urlVar">
<cfset destination = destination&"&"&urlVar&"="&url[urlVar]>
</cfloop>
<cfelse>
<cfset destination = url.destination>
</cfif>
This actually recontructed the URL correctly with all the URL vars, but the
problem is this particular link is case sensitive and does not work when the url
vars got recontructed in uppercases letters.
Maybe I'm doing the whole redirect thing incorrectly or theres an easier way.
But if anybody can help me out, I would appreciate it. Thanks.
----- Excess quoted text cut - see Original Post for more -----
Author: Nick Tong - TalkWebSolutions.co.uk
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#239620
I think the simplest solution is to uCase the variables when you pass
them via the URL.
----- Excess quoted text cut - see Original Post for more -----
Author: Dave Watts
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#239618
----- Excess quoted text cut - see Original Post for more -----
You can't, really. CF doesn't think that's important information, so it
doesn't store variable names that way. This is common in case-insensitive
programming languages, I suspect. You could, however, examine the query
string directly.
But why do you need the case of the variable name to be preserved anyway?
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
Fig Leaf Software provides the highest caliber vendor-authorized
instruction at our training centers in Washington DC, Atlanta,
Chicago, Baltimore, Northern Virginia, or on-site at your location.
Visit http://training.figleaf.com/ for more information!
Author: Robertson-Ravo, Neil (RX)
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#239619
I don't think you can - CF has always uppercased the Keys.
Hi Everybody,
I'm trying to get the name/value pair from url variables. Lets say I have a
url like this:
http://someurlhere.com?Src=blahblah&storyID=1234
Now if I do the following I'll get the name/value pair of the URL vars:
<cfloop collection=#url# item="urlVar">
<cfoutput>#urlVar# = #url[urlVar]#</cfoutput><br />
</cfloop>
My problem is the name element doesn't keep the same case as the actualy url
variable name. Src and storyID gets displayed as SRC and STORYID in the
output. How can I keep the case the same when I loop thru the URL
structure?
Author: Raymond Camden
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#239617
You can just parse it as a list of lists. The main list is a list
delimited by &. The sub lists are delimited by =. You would need to
urlDecodedFormat() on the right hand side.
Oh, and the variable itself comes from cgi.query_string.
----- Excess quoted text cut - see Original Post for more -----
Author: Everett, Al \(NIH/NIGMS\) [C]
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#239616
I don't think you can. CF is case-insensitive for one thing.
It looks like case MIGHT be preserved in CGI.QUERY_STRING. So you could
try the following:
<cfloop list="#CGI.QUERY_STRING#" delimiter="&" index="keyvalue">
<cfoutput>#listFirst(keyvalue,"=")# =
#listLast(keyvalue,"=")#</cfoutput>
</cfloop>
A couple of problems with that, of course:
- Any URL variables you've explicitly set (such as with cfparam) or
removed won't be accounted for.
- You need to care for instances when there is a key but no value.
"key1=&key2=a"
Why do you need to see your URL variables in their original case?
Hi Everybody,
I'm trying to get the name/value pair from url variables. Lets say I
have a url like this:
http://someurlhere.com?Src=blahblah&storyID=1234
Now if I do the following I'll get the name/value pair of the URL vars:
<cfloop collection=#url# item="urlVar">
<cfoutput>#urlVar# = #url[urlVar]#</cfoutput><br />
</cfloop>
My problem is the name element doesn't keep the same case as the actualy
url variable name. Src and storyID gets displayed as SRC and STORYID in
the output. How can I keep the case the same when I loop thru the URL
structure?
Author: Tuan Tran
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:45822#239614
Hi Everybody,
I'm trying to get the name/value pair from url variables. Lets say I have a url
like this:
http://someurlhere.com?Src=blahblah&storyID=1234
Now if I do the following I'll get the name/value pair of the URL vars:
<cfloop collection=#url# item="urlVar">
<cfoutput>#urlVar# = #url[urlVar]#</cfoutput><br />
</cfloop>
My problem is the name element doesn't keep the same case as the actualy url
variable name. Src and storyID gets displayed as SRC and STORYID in the output.
How can I keep the case the same when I loop thru the URL structure?
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||