[SOLVED] page title in UDT

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
essexboyracer
Forum Members
Forum Members
Posts: 85
Joined: Wed Jun 20, 2007 5:40 pm

[SOLVED] page title in UDT

Post by essexboyracer »

Hi All,

I have an UDT called {bookmark} and it basically allows somwone to bookmark a page, as follows;

Code: Select all

$url = $_SERVER['REQUEST_URI']; 

echo "<a href=\"javascript:bookmarksite('Page title needs to go here', 'http://www.mysite.co.uk" . $url . "')\" title=\"Bookmark this page\"><img src=\"/images/bookmark.png\" width=\"16\" height=\"16\" border=\"0\"> Bookmark</a>";
What I am struggling to find out is how to get the page title into it. The javascript comes from dynamicdrive;

Code: Select all

/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}
Last edited by essexboyracer on Wed Feb 27, 2008 3:13 pm, edited 1 time in total.
essexboyracer
Forum Members
Forum Members
Posts: 85
Joined: Wed Jun 20, 2007 5:40 pm

[SOLVED] page title in UDT

Post by essexboyracer »

Done it. get the javascript js file first

1. Create a Global Content Block, call it say 'bookmark3'

Code: Select all

<a href="javascript:bookmarksite('Name of my site - {description}', 'http://www.mydomain.co.uk{bookmark2}')" title="Bookmark Name of my Site"><img src="/images/bookmark.png" width="16" height="16" border="0"> Bookmark</a>

2. Create a UDT call it say bookmark2, put the following in it...

Code: Select all

$url = $_SERVER['REQUEST_URI']; 

echo $url;
3. Call the GCB in your page;

Code: Select all

{global_content name='bookmark3'}
Post Reply

Return to “CMSMS Core”