Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Relative address for a page Link?Relative address for a page Link?
Previous
 
Next
New Post
6/2/2009 4:21 PM
 

Good afternoon

I want to link from text (in a text/html module) directly to a product in a store catalog.  The reason is to allow the customer to by-pass the store->category->product heirarchy and just link directly to the product discussed in module's text, sort of a buy now approach. 

I can cut and paste the link, and it would look something like this:
http://localhost/dnn40904_mywebsite/Store/tabid/56/cid/1/mycategory.aspx

This works but do you see the problem?  This is a hard coded link that will be a broken link when the site is up uploaded to the live server.   I could remember to manually edit this link on the live server, but if there are many such links, the work goes up and the chance of missing an edit goes up.

The desired solution would be to encapsulate the link in an Object reference or otherwise have a relative URL that will work without change on the live site.
My problems is that I don't know the language syntax.
Can someone refer me to a code example or refer me to a solution?

Thank you!
-BigD

 
New Post
6/2/2009 7:09 PM
 

You can run something like this against your database once you publish the site to production to change the root url (portal alias). We have had to do this because of different links using the full url on our staging server. 
 


UPDATE HtmlText
SET DesktopHtml = REPLACE(CAST(DesktopHtml AS nvarchar(max)),N'http://localhost/dnn40904_mywebsite',N'http://www.productionurl.com')
WHERE DesktopHtml LIKE ('%http://localhost/dnn40904_mywebsite%')


However, the issue you may run into with this method is the fact that the tabid and cid will change between the two databases. I am not sure there would be an easy way to work around that issue. With some creative sql coding you may be able to do it.

So, if you know that what was Category 1 is now Category 2 and TabId 56 is now TabId 42 this could work for you:


UPDATE HtmlText
SET DesktopHtml = REPLACE(CAST(DesktopHtml AS nvarchar(max)),N'/Store/tabid/56/cid/1/mycategory.aspx ',N'/Store/tabid/42/cid/2/mycategory.aspx ')
WHERE DesktopHtml LIKE ('%N'/Store/tabid/56/cid/1/mycategory.aspx'%')


The issue with this is you would have to hand craft a new query for each category and/or tabid that has changed. You may be able to use SQL to grab the new ideas by querying for the category and/or tab by name. Then you could build your replacement string as a SQL variable and pass it to the replace method. This would take some of the manual work out of it, by preventing you from having to track down each id by hand.

I know this is probably not the answer you were hoping for but I hope it helps. AND PLEASE REMEMBER TO BACKUP YOUR PRODUCTION DATABASE BEFORE TRYING ANY ON THIS!!! <- can you tell I cannot stress that enough?

 
New Post
6/2/2009 7:16 PM
 

Interestingly I just seen this post right after I replied... http://www.dotnetnuke.com/Community/Forums/tabid/795/forumid/-1/threadid/266015/scope/posts/Default.aspx

I have not looked into it yet, so I am not sure it will be exactlly what you are looking for but it looks pretty close.

 
New Post
6/2/2009 7:59 PM
 

ITLackey

Thank you for taking the time to reply, and thanks for the link.

-DL

 
New Post
6/3/2009 11:08 AM
 

You are very welcome, I hope it helps! Please let us know if you try the search and replace tool(s) referenced in the link I posted. I am interested to hear about your experince.

Thanks!

 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Relative address for a page Link?Relative address for a page Link?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out