Is it possible to specify window parameters when I open a new page for a link?

3 posts by 2 authors in: Forums > CMS Builder
Last Post: April 8, 2012   (RSS)

Re: [joy] Is it possible to specify window parameters when I open a new page for a link?

Hi Joy,

I may be missing something, but if all you want to do is insert a map URL, the only thing you really need to use in the php viewer code would be a php call for appropriate the map URL.

Let's say that the map URL is stored in a text field called map_url, in an editor called companies, then your body code for a list page could be as easy as:

<?php foreach ($companiesRecords as $record ): ?>
<A HREF='#'onClick="window.open('<?php echo $record[map_url'] ?>','_blank','width=500,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=no');return false" onmouseover="window.status='Map'; return true;">map for directions</A>.
<?php endforeach; ?>

Or for a Detail page:
<A HREF='#'onClick="window.open('<?php echo $companiesRecord[map_url'] ?>','_blank','width=500,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=no');return false" onmouseover="window.status='Map'; return true;">map for directions</A>.

Of course you'd have to have the appropriate load records calls at the top of your page copied from your admin code generator.

I'd suggest including the following code just before the <A href code. It will make sure that if a urls does not have an http:// at it's start, one is added and the link is not broken.

For the List page:
<?php

if (!preg_match("/^http:\/\//", $record['map_url'])) {
$record['map_url'] = "http://" . $record['map_url']; }

?>
<?php endif ?>

For the detail page:

<?php

if (!preg_match("/^http:\/\//", $companiesRecord['map_url'])) {
$companiesRecord['map_url'] = "http://" . $companiesRecord['map_url']; }

?>
<?php endif ?>


If you want to change other parameters or add other information in your viewers, just replace the actual dynamic information with php calls to other fields in your Company records.

There's a lot of information on how CMSB works, converting html pages, and hundreds of "how to"
recipes in my CMSB Cookbook at http://www.thecmsbcookbook.com

Good luck with your pages.

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Is it possible to specify window parameters when I open a new page for a link?

By joy - April 8, 2012

Thank you for your reply Jerry, I appreciate that you took the time to respond.

Actually, it turns out that since I am so new to the interface I didn't actually see the 'html' link. After I inserted a link from the interface, I was able to click the 'html' button and edit the code directly to do what I wanted. This was all I needed to do to create the position and size for the popup map window.

I did not find the information either on the support site or in the interface indicating that I could directly edit the html/php code for the page.

Thought I would post the solution in case it helps someone else.

Cheers.