Store Front Contact Us Projects Blog PHP Tutorials Community Forums Support Downloads Client Area Homepage
Insane Visions
Insane Visions - Top Navigation

Hello Guest! Please Login or Register.

Insane Visions :: Viewing Topic - Tutorial: Relative Image URL's
Home > AdaptCMS Lite > Tutorial: Relative Image URL\'s
 



Elven6




Joined: Jan 2010
Posts: 11
Online Tag: Mehar
Reputation: 0  [+  -]




User is Offline
New Post(s) Posted: Jan 17, 2010 - 12:16 pm

Giving your AdaptCMS installation "Relative URL's" will help you out greatly in the long run. Why? Because having a URL like

Quote:
http://yoursite.com/upload/coolpic.jpg


This is called a "Absolute URL" and could pose a problem if you change domains folders etc. In comparison having something like

Quote:
/upload/coolpic.jpg

Would reduce such errors to a certain extent. If you have over 2000 articles in your database it might not be very feasible to manually change the URL's for all the images you've used after making a change to your file system.

Fortunately TinyMCE has a feature built in to handle relative URL's!

  • Open functions.php in your editor of choice.
  • Find the WYSIWYG function (doing a search for WYSIWYG will do the trick).

In the WYSIWYG function find

Quote:
relative_urls

As of writing it should be set to false change it to true.

Quote:
relative_urls : true

Moving up a bit directly under

Quote:
elements : 'abshosturls'

Add

Quote:
document_base_url : '".$siteurl."'

The siteurl variable was defined above immediately following the function it pulls the information from what you have listed in your Admin Panel for your URL.

  • Save the file.
  • Upload it to your server.
  • Test it out on anything that uses TinyMCE in AdaptCMS.

Keep in mind however that both Relative and Absolute URL's have their benefits in the end it's up to preference. This will also work in anything running TinyMCE including AdaptBB OneCMS etc.

And you're done! Questions comments etc? Post away!

Further Reading

http://www.webdevelopersnotes.com/design/relative_and_absolute_urls.php3

http://brainstormsandraves.com/archives/2003/09/07/relative_vs_absolute_urls/



OneCMS: http://onecms.net






Page processed in 0.059 seconds.
Insane Visions - Footer