Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-01-30 21:10:32

darock
Member
Registered: 2007-11-23
Posts: 54

Changing the paths of my urls when migrating over to TXP

Okay, so I’ve finished coding my pages in static html. And now I’m ready to port the code over into a TXP site

I’ve found it a bit tedious to change the url paths in my html that looks like this;

<img class="logo" src="images/logo.gif" />

to look like this in TXP;

<img class="logo" src="/images/logo.gif" />

or in my CSS that looks like this;

background: transparent url(images/navtabs.gif);

to this;

background: transparent url(/images/navtabs.gif);

It seems the images don’t appear without that forward slash.

Is there another way to do and/or avoid this?

Offline

#2 2008-01-30 21:13:18

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Changing the paths of my urls when migrating over to TXP

After you’ve ported your code to TXP, you can do a search and replace query in MySQL to change them all at once… well, maybe it requires a few queries, one for each table involved (articles, forms, css, pages)

Offline

#3 2008-01-30 21:17:27

darock
Member
Registered: 2007-11-23
Posts: 54

Re: Changing the paths of my urls when migrating over to TXP

Hmmm…seems quite a bit of work though especially since I know nothing of MySQL. Though, I can certainly look into it.

The temporary fix that I have at this moment is to do a “find and replace” in Dreamweaver whereby I find “images/” and replace with “/image/” .

I was also asking just to make sure it wasn’t my coding practices that was causing more work than needed as well?

Offline

#4 2008-01-30 22:56:01

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Changing the paths of my urls when migrating over to TXP

darock wrote:

I was also asking just to make sure it wasn’t my coding practices that was causing more work than needed as well?

Well, the nature of Textpattern sites (perhaps any CMS-based website) is such that you have to handle URLs a little more carefully than on a static site. The same content can appear under more than one URL. And you can run your site under various URL schemes. A single article can appear under different URLs. Hence root-relative URLs (beginning with a forward slash) become very useful.


Code is topiary

Offline

#5 2008-01-30 23:01:38

darock
Member
Registered: 2007-11-23
Posts: 54

Re: Changing the paths of my urls when migrating over to TXP

Ah…I learn something new everyday.

So it is safe to assume that most of the developers here are using some sort of find and replace method similar to Ruud’s or mine? I’m glad to know I wasn’t creating more work for myself than needed!

Offline

#6 2008-01-31 01:49:48

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Changing the paths of my urls when migrating over to TXP

darock wrote:

So it is safe to assume that most of the developers here are using some sort of find and replace method similar to Ruud’s or mine?

If I were in your shoes, I would do the find & replace before importing into Textpattern. But that’s just my preference, because I’m more comfortable doing this with text files than with a database. Don’t know what tools you have or like to use, but many text editors can do find & replace across a directory of files. Even better with regular expressions. Global find & replace: it’s a tool I couldn’t do without.

Another thing to consider is that Textpattern has its own image handling. You don’t have to use it, or you can use it for some things and not for others, but you may end up doing things such as <txp:image id="4" /> in place of things such as <img src="/images/logo.gif" alt="" height="50" width="100" />


Code is topiary

Offline

Board footer

Powered by FluxBB