Some advices for common programmers problems

Sometimes there’s a need to create custom block positions. For example one can divide ‘Left’ block into ‘LeftTop’ and ‘LeftBottom’.

The block position template can be found in lib/data/ary.blocksNames.php. One can override these values and create his own layout template by setting a global variable.

$GLOBALS['_SGL']['aBlocksNames'] = array(
    ‘Right’=> ‘Right’,
    ‘LeftTop’ => ‘LeftTop’,
    ‘LeftBottom’ => ‘LeftBottom’,
    ‘Top’ => ‘Top’,
    ‘Bottom’ => ‘Bottom’,
    ‘BodyTop’ => ‘BodyTop’,
    ‘AdminCategory’ => ‘AdminCategory’,
    ‘AdminNav’ => ‘AdminNav’,
    ‘AdminBreadcrumbs’ => ‘AdminBreadcrumbs’,
    ‘MainNav’ => ‘MainNav’,
    ‘MainBreadcrumb’ => ‘MainBreadcrumb’,
    );

Seagull Trac informs that it works since 0.6.2, but in fact it also works with Seagull 0.6.1.

Sms-y do sieci Orange można wysyłać ze strony sms.orange.pl. Tam też znajduje się opis możliwości oraz regulamin.

Bramka umożliwia wysłanie do 10 smsów na dobę do jednego użytkownika. Sms zostanie wysłany po wpisaniu do specjalnego pola wyrazu z obrazka.

Wg regulaminu usługa jest dostępna wyłącznie w komunikacji prywatnej.

Aby mieć moźliwość otrzymywania wiadomości sms z Internetu, nalezy wysłać sms o treści INTERNET pod numer 102.

Bramka Orange zostałą użyta na stronie vbs.pl

here is the text to be written

..

And this should be checked:
http://www.squarefree.com/bookmarklets/misc.html#edit_page

New very clearly explained API: www.prototypejs.org/api

and this article is realy helpful:
www.xml.com/pub/a/2007/01/24/whats-new-in-prototype-15.html

I wanted to make a Seagull module that uses Google Maps. First step is to add javascript file with the key. It can be done by adding

<script src=”http://maps.google.com/maps?file=api&amp;v=2&amp;key=abcde”
type=”text/javascript”></script>

I wanted to add it in my manager in such a way

$output->addJavascriptFile(array(’http://maps.google.com/maps?file=api&amp;v=2&amp;key=abcde’));

Unfortunately it doesn’t work. The page displayed the message: “The Google Map API key used for this web site was registered for a different web site…”. I created another key, but it didn’t help.
I noticed that my addJavascriptFile method produces the code where “amp;” is doubled whenever it appears

http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=abcde’

It caused the error.
Finally I removed “amp;”s, so my piece od code looks like this

$output->addJavascriptFile(array(’http://maps.google.com/maps?file=api&v=2&key=abcde’));

Now it works :-)

I wanted to enable AJAX in admin section of Oscommerce. I have done it in similar way as in Seagull. I used script.aculo.us framework.
I will show it on oscommerce/catalog/admin/configuration.php as an example.

First of all, javascript and style files have to be appended to the file.

<link rel=”stylesheet” type=”text/css” href=”includes/ajax.css”>
<script language=”javascript” src=”includes/scriptaculous/lib/prototype.js”></script>
<script language=”javascript” src=”includes/scriptaculous/src/scriptaculous.js?load=effects,dragdrop”></script>
<script language=”javascript” src=”includes/ajax.js”<</script>

ajax.css and ajax.js are my original files.

In Html I put


<input type=’button’ name=’guzik’ value=’Link do szablonu’ onClick=doAjaxMethodShowTemplate(’param’)>

to call AJAX function defined in ajax.js.


function doAjaxMethodShowTemplate(tpl) {
new Ajax.Request( HTTP_CATALOG_SERVER + DIR_WS_ADMIN + ‘includes/ajax.php?action=template’, {
method: ‘post’,
asynchronous:true,
parameters: ‘tpl=’ + tpl,
onSuccess: function(transport) {
center($(”dialog”));
$(”dialog”).style.visibility = ‘visible’;
$(”template”).innerHTML = transport.responseText;
}
});
}

tpl is a name of template to display. It is a parameter of function doAjaxMethodShowTemplate(), next fetched as a paremater to php function called.

One problem that occured was that javascript had to have access to HTTP_CATALOG_SERVER and DIR_WS_ADMIN defined in php file. I solved it by enabling these variables in javascript by:

<?php
echo(”<script type=’text/javascript’>”);
echo(”var HTTP_CATALOG_SERVER = ‘”.HTTP_CATALOG_SERVER.”‘;”);
echo(”var DIR_WS_ADMIN = ‘”.DIR_WS_ADMIN.”‘;”);
echo(”</script>”);
?>

in body section of configuration.php.

Code that is executed in php script is

echo “<iframe src=’”.HTTP_CATALOG_SERVER.”atemplates/”.$_POST['tpl'].”/allegro.html’ width=’100%’ height=’100%’></iframe>”

A pop-up window can be displayed with javascript method window.open

oNewWindow = window.open( [sURL] [, sName] [, sFeatures] [, bReplace])

sURL - URL of the document to display

sFeatures - features

channelmode = { yes | no | 1 | 0 }
directories = { yes | no | 1 | 0 }
fullscreen = { yes | no | 1 | 0 }
location = { yes | no | 1 | 0 }
menubar = { yes | no | 1 | 0 }
menubar = { no | 0 }
resizable = { yes | no | 1 | 0 }
scrollbars = { yes | no | 1 | 0 }
status = { yes | no | 1 | 0 }
titlebar = { yes | no | 1 | 0 }
toolbar = { yes | no | 1 | 0 }
top = number
left = number
width = number
height = number

To be continued