Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 197
  • Last Modified:

Coldfusion page does not display hyperlinks properly

i am trying to fix an issue with a certain Coldfusion generated PAGE. In the "How to Apply" section of the page there is meant to be included a URL for a certain website, however the page shows only the first part of the URL in clickable hyperlink format, and everything after the / is shown as plain text. Can you please suggest a solution ?

Please note that these are extracted from the database and displayed dynamically in web pages.

please check this image for how it looks in the database :

image

I have been able to find the specific bit responsible of generating the section, but i don't know what to change there,  if i can get any help on that, that would be greatly appreciated!


<div class="display-item last">
			<div id="how-to-apply">
				<h2>How to apply</h2>
				<p>#formatWithLinks(Arguments.data.ApplicationProcedure)#</p>
				<dl>
					<dt>Closing date</dt>
						<cfif Arguments.data.HasClosingDate>
						<dd>#DateFormat(Arguments.data.ClosingDate, "D MMMM YYYY")#</dd>
						<cfelse>
						<dd>None: ongoing recruitment</dd>
						</cfif>
				</dl>
			</div>
		</div> 

Open in new window


thank you
0
JayWeb
Asked:
JayWeb
  • 5
  • 4
  • 3
  • +1
1 Solution
 
dgrafxCommented:
You'll need to post your formatWithLinks function.
Also post  a record from the database - raw code direct from the database - only the column(s) that is fed into the formatWithLinks function.
0
 
_agx_Commented:
Tip, CF questions attract more attention when you use the CF topic:
http://www.experts-exchange.com/Programming/Languages/Scripting/Cold_Fusion_Markup_Language/
0
 
JayWebAuthor Commented:
my colleague managed to solve the issue, and i was trying to know from him how he solved it, but all he sent me was that line of code: output = REReplaceNoCase(output,"(\bhttp://[a-z0-9\.\-_:~@##%&/?+=]+)", "<a href=""\1"">\1</a>", "all");  if someone can suggest where this have probably gone that would be great so we can answer and close the question
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
_agx_Commented:
>> if someone can suggest where this have probably gone that would
>> be great so we can answer and close the question

Not sure I understand what you mean. Are you asking for additional help OR posting the solution? :)

If you need further help, please post the original code for the formatWithLinks function as dgrafx requested. Then someone can help you adjust it.

Otherwise, you can accept your own response as "the answer".  However, for it to be useful to others, you should include the original code as well.
0
 
JayWebAuthor Commented:
agx, what i mean is if someone can tell me where this expression goes because i wasn't able to find out where it should be included.
0
 
_agx_Commented:
Sure. I'm not sure if you saw the edit to my comment above:

...please post the original code for the formatWithLinks function as dgrafx requested. Then someone can help you adjust it
0
 
JayWebAuthor Commented:
I don't seem to be able to edit the question that's the problem!
0
 
_agx_Commented:
In EE, you can't edit a post after someone else has responded.  

Just post the code as a new comment instead.
0
 
gdemariaCommented:
You don't need help from more experts, you have the best already helping you.   All you need to do is post the code as they have asked.   How can we help you without seeing the code?
0
 
JayWebAuthor Commented:
Thank you very much for the attention and trying to help. the problem is i haven't been able to locate the files where user located functions are located. if someone can suggest a specific location that i can check that would be greate. otherwise , i can select any answer and close the question.
many thanks
0
 
gdemariaCommented:
Ok, let's see..   the code you posted at the top, is that in a .cfm file or a .cfc file?

If it's in a .cfc file, you can search the file for the function.   If it's not there, check the first line of the code <cfcomponent for the word expand and see if there is a name in there.  That would be another file to check.

If it's a .cfm file, check the file itself, look in any file mentioned in a CFINCLUDE,  you can also check the application.cfm file (if there is one in the root).

You can also try a search of all files.
0
 
JayWebAuthor Commented:
Hi gdemaria, thank you very much for your suggestions, I tried looking for the locations you mentioned, but no luck there, please look at the complete jobsearch project i have, maybe you can provide further help if you have a complete idea about the structure, the file listing.cfm which the bit at the top is  from, is located in view/modules. please have a look and let me know your thoughts.,

many thanks
0
 
gdemariaCommented:
The function is located in your view.cfc file in the top folder, for everyone, here is the function code:

	<cffunction name="formatWithLinks" output="false" returntype="string">
		<cfargument name="input" />
		<cfscript>
			var output = Arguments.input;
			/*var httpREWithProtocol = "(?x)
					(
						((https|http):\/\/)		## protocol
						(
							[a-zA-Z]{1}			
							([\w-]+\.)+
							([a-zA-Z]{2,})		## top level domain
						)						## domain name
						(:[\d]{1,5})?			## port number
						((/?\w+/)+|/?)
						(\w+\.[\w]{3,4})?
						((\?\w+=\w+)?
						(&\w+=\w+)*)?
					)";*/
			var httpREWithoutProtocol = "(?x)
					(\s)						## Space requirement here means this won't match beginning of string
					(
						(
							[a-zA-Z]{1}			
							([\w-]+\.)+
							([a-zA-Z]{2,})		## top level domain
						)						## domain name
						(:[\d]{1,5})?			## port number
						((/?\w+/)+|/?)
						(\w+\.[\w]{3,4})?
						((\?\w+=\w+)?
						(&\w+=\w+)*)?
					)";
			var httpREWithoutProtocolBeginningOfString = "(?x)
					^							## Match string here; I don't like doing it this way, but at least it works
					(
						(
							[a-zA-Z]{1}			
							([\w-]+\.)+
							([a-zA-Z]{2,})		## top level domain
						)						## domain name
						(:[\d]{1,5})?			## port number
						((/?\w+/)+|/?)
						(\w+\.[\w]{3,4})?
						((\?\w+=\w+)?
						(&\w+=\w+)*)?
					)";
			var emailRE = "(?x)
					(
						[\S]+@						## user
						[a-zA-Z]{1}				
						([\w-]+\.)+
						([a-zA-Z]{2,})
					)";
			output = REReplace(output, "<[^>]*>", "", "all");
			output = XMLFormat(output);
			//output = REReplace(output, httpREWithProtocol, "<a href=""\1"">\1</a>", "all");
			 output = REReplaceNoCase(output,"(\bhttp://[a-z0-9\.\-_:~@##%&/?+=]+)", "<a href=""\1"">\1</a>", "all");
			output = REReplace(output, httpREWithoutProtocol, "\1<a href=""http://\2"">\2</a>", "all");
			output = REReplace(output, httpREWithoutProtocolBeginningOfString, "<a href=""http://\1"">\1</a>", "all");
			output = REReplace(output, emailRE, "<a href=""mailto:\1"">\1</a>", "all");
			return output;
		</cfscript>
	</cffunction>

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 5
  • 4
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now