Forum Moderators: coopster

Message Too Old, No Replies

Need help with creating a new window

         

trf000

3:16 pm on Jul 27, 2007 (gmt 0)

10+ Year Member



I am using a CMS that has a podcast module. I want the podcast to open in a new window with a predetermined size, and preferably some content (a header with a logo, stuff like that.)

The link to play the podcast looks like this:


$tags['LISTEN_TO_FILE_TEXT_LINK'] = '<a href="files/podcaster/' . $this->_file['name'] . '" target="_blank">' . $_SESSION['translate']->it('Listen') . '</a>';

Will i need to create a new php file? Any help is appreciated.

vincevincevince

4:24 pm on Jul 27, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do a quick search for 'javascript popup' or similar and what you need to do is implement the 'window.open()' function within the onClick handler of that link.

It's not really a PHP solution (PHP doesn't control window size etc.).

If you can do without extra graphics, then you can do it purely with that javascript. If you really need extra graphics then you will need both javascript and a new PHP page.

StudioKraft

4:26 pm on Jul 27, 2007 (gmt 0)

10+ Year Member



Hello,

You will first need to insert a JavaScript function into the HEAD of your CMS Template, or inside the .js file that the CMS Template uses. The function should look something like this:


function sk_popUp(url,width,height) {

popUpParams = "location=1, menubar=0, scrollbars=1, resizable=1, status=0, toolbar=0, width=" + width + ", height=" + height;
window.open(url,'skPopUp',popUpParams);

}

You can then change your link to:


$popUpUrl = "files/podcaster/' . $this->_file['name'] . '";
$popUpWidth = 400;
$popUpHeight = 400;

$tags['LISTEN_TO_FILE_TEXT_LINK'] = '<a href="javascript:sk_popUp(\'' . $popUpUrl . '\',\'' . $popUpWidth . '\',\'' . $popUpHeight . '\');" target="_blank">' . $_SESSION['translate']->it('Listen') . '</a>';

Failing that, you could add the complete "window.open" line to the link, but using the function is much more flexible.

Hope this helps,

SK