php-general Digest 26 Nov 2011 02:41:46 -0000 Issue 7584

Topics (messages 315807 through 315818):

Is there a decent design app ?
        315807 by: Andreas
        315808 by: muad shibani

Howto detect the hostname of the server?
        315809 by: Andreas
        315810 by: Stuart Dallas
        315811 by: Mark Kelly
        315812 by: Stuart Dallas
        315813 by: Stuart Dallas
        315814 by: Simon J Welsh
        315816 by: Andreas

Tutorial for the structure of an php-app ?
        315815 by: Andreas
        315817 by: Tommy Pham
        315818 by: Bastien

Administrivia:

To subscribe to the digest, e-mail:
        [email protected]

To unsubscribe from the digest, e-mail:
        [email protected]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Hi

Is there a decent design app that can automatically update links within the pages of a php site whenever a referred file gets moved or renamed?

Like you have /foo.css and for some reason or another you move it to /lib/css and rename it to bar.css. Now it'd be nice if an IDE was aware of all the references within a site and update the affected urls.



--- End Message ---
--- Begin Message ---
you can use find and replace feature in some IDEs to accomplish your task
..
Dreamweaver do the job but with links inside HTML code

On Sat, Nov 26, 2011 at 2:17 AM, Andreas <[email protected]> wrote:

> Hi
>
> Is there a decent design app that can automatically update links within
> the pages of a php site whenever a referred file gets moved or renamed?
>
> Like you have /foo.css and for some reason or another you move it to
> /lib/css and rename it to bar.css.
> Now it'd be nice if an IDE was aware of all the references within a site
> and update the affected urls.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
*_______________*
*
*
السجل .. كل الأخبار من كل مكان

www.alsjl.com

صفحة السجل على فيسبوك
http://www.facebook.com/alsjl

*Muad Shibani*
*
*
Aden Yemen
Mobile: 00967 733045678

www.muadshibani.com

--- End Message ---
--- Begin Message ---
Hi,
how could I identify the server the script runs on?

I've got a testserver on Windows and a remote system on Linux that need a couple of different settings like IP and port of db-server or folder to store logfiles.

I'd like to do something like:

if ( $_SERVER['some_key'] = 'my_test_box' ) {
    $db_host = '1.1.1.1';
    $db_port = 1234;
} else {
    $db_host = '2.2.2.2';
    $db_port = 4321;
}


I looked into phpinfo() but haven't found anything helpful, yet.
Have I overlooked something or is there another way to identify the server?

--- End Message ---
--- Begin Message ---
On 26 Nov 2011, at 00:14, Andreas wrote:
> Hi,
> how could I identify the server the script runs on?
> 
> I've got a testserver on Windows and a remote system on Linux that need a 
> couple of different settings like IP and port of db-server or folder to store 
> logfiles.
> 
> I'd like to do something like:
> 
> if ( $_SERVER['some_key'] = 'my_test_box' ) {
>    $db_host = '1.1.1.1';
>    $db_port = 1234;
> } else {
>    $db_host = '2.2.2.2';
>    $db_port = 4321;
> }
> 
> 
> I looked into phpinfo() but haven't found anything helpful, yet.
> Have I overlooked something or is there another way to identify the server?


This should work on most Linux variants, so long as the hostname command exists 
and the PHP process has permission to execute it.

function getServerHostname($full = false)
{
        $retval = `hostname`;
        if (!$full) {
                $retval = array_shift(explode('.', $retval));
        }
        return $retval;
}

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

--- End Message ---
--- Begin Message ---
Hi.

On Saturday 26 Nov 2011 at 00:14 Andreas wrote:

> how could I identify the server the script runs on?

[snip]
 
> I looked into phpinfo() but haven't found anything helpful, yet.
> Have I overlooked something or is there another way to identify the server?

Wouldn't the server IP address in $_SERVER['SERVER_ADDR'] or the hostname in 
$_SERVER['SERVER_NAME'] do the trick? That's what I use. The second one is 
handy for differentiating between sites when using Apache name-based virtual 
hosts on the same IP.

Full list here:

http://uk.php.net/manual/en/reserved.variables.server.php

Cheers,

Mark

--- End Message ---
--- Begin Message ---
On 26 Nov 2011, at 00:24, Stuart Dallas wrote:
> On 26 Nov 2011, at 00:14, Andreas wrote:
>> Hi,
>> how could I identify the server the script runs on?
>> 
>> I've got a testserver on Windows and a remote system on Linux that need a 
>> couple of different settings like IP and port of db-server or folder to 
>> store logfiles.
>> 
>> I'd like to do something like:
>> 
>> if ( $_SERVER['some_key'] = 'my_test_box' ) {
>>   $db_host = '1.1.1.1';
>>   $db_port = 1234;
>> } else {
>>   $db_host = '2.2.2.2';
>>   $db_port = 4321;
>> }
>> 
>> 
>> I looked into phpinfo() but haven't found anything helpful, yet.
>> Have I overlooked something or is there another way to identify the server?
> 
> This should work on most Linux variants, so long as the hostname command 
> exists and the PHP process has permission to execute it.
> 
> function getServerHostname($full = false)
> {
>       $retval = `hostname`;
>       if (!$full) {
>               $retval = array_shift(explode('.', $retval));
>       }
>       return $retval;
> }


I should add that it would be better to put the server hostname into the 
environment in which PHP runs. That way it will be available via the $_ENV 
superglobal and fetching it will not cost a process execution. How you would do 
this depends on how you are running PHP.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


--- End Message ---
--- Begin Message ---
On 26 Nov 2011, at 00:24, Stuart Dallas wrote:
> On 26 Nov 2011, at 00:14, Andreas wrote:
>> Hi,
>> how could I identify the server the script runs on?
>> 
>> I've got a testserver on Windows and a remote system on Linux that need a 
>> couple of different settings like IP and port of db-server or folder to 
>> store logfiles.
>> 
>> I'd like to do something like:
>> 
>> if ( $_SERVER['some_key'] = 'my_test_box' ) {
>>   $db_host = '1.1.1.1';
>>   $db_port = 1234;
>> } else {
>>   $db_host = '2.2.2.2';
>>   $db_port = 4321;
>> }
>> 
>> 
>> I looked into phpinfo() but haven't found anything helpful, yet.
>> Have I overlooked something or is there another way to identify the server?
> 
> 
> This should work on most Linux variants, so long as the hostname command 
> exists and the PHP process has permission to execute it.
> 
> function getServerHostname($full = false)
> {

This line should have a trim...

>       $retval = trim(`hostname`);

Without that, the full hostname will have a new line on the end which is less 
than ideal.

>       if (!$full) {
>               $retval = array_shift(explode('.', $retval));
>       }
>       return $retval;
> }

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


--- End Message ---
--- Begin Message ---
On 26/11/2011, at 1:14 PM, Andreas wrote:

> Hi,
> how could I identify the server the script runs on?
> 
> I've got a testserver on Windows and a remote system on Linux that need a 
> couple of different settings like IP and port of db-server or folder to store 
> logfiles.
> 
> I'd like to do something like:
> 
> if ( $_SERVER['some_key'] = 'my_test_box' ) {
>    $db_host = '1.1.1.1';
>    $db_port = 1234;
> } else {
>    $db_host = '2.2.2.2';
>    $db_port = 4321;
> }
> 
> 
> I looked into phpinfo() but haven't found anything helpful, yet.
> Have I overlooked something or is there another way to identify the server?


php_uname('n'); http://php.net/php_uname
---
Simon Welsh
Admin of http://simon.geek.nz/


--- End Message ---
--- Begin Message ---
Am 26.11.2011 01:35, schrieb Simon J Welsh:
On 26/11/2011, at 1:14 PM, Andreas wrote:

how could I identify the server the script runs on?


php_uname('n'); http://php.net/php_uname


Great, that even works on a ssh-tunnel.
I got derailed by the fact that my tunnel maps the remote server to localhost:80 so
$_SERVER['SERVER_ADDR']   and
$_SERVER['SERVER_NAME']   wouldn't help.
On the other hand for everyone on the remote LAN $_SERVER['...'] would work ok, though I didn't realise that before.

Thanks   :)

--- End Message ---
--- Begin Message ---
Hi again,
is there a tutorial for the structure of an php-app?

There are more than enough books and online docs that teach the basics of PHP and of course the native mysql commands.

I'd now rather need a help to figure out how to pull up a wee bit more complex app. I know how to connect to a DB even though it might not be mysql. I can select stuff and dump it into a HTML table.
Actually I prefer PDO and PostgreSQL.

Is there a tutorial that teaches how to construct a app with a 2-column design.
E.g. a menue frame on the left and a bigger content area on the right.
So a click on a menue item would dynamically display a form or a list in the content area.
What is a good way to glue everthing together between login and logout.
I know cookies and sessions and I suspect those were a way to do it.
How would I integrate a template system like smarty?
It weren't bad if there were clues about AJAX, too.

I'm in search of a way to extend the knowledge about bricks, tubes and cables to the wisdom to actually build a house out of those things.
--- End Message ---
--- Begin Message ---
On Fri, Nov 25, 2011 at 4:38 PM, Andreas <[email protected]> wrote:
> Hi again,
> is there a tutorial for the structure of an php-app?
>
> There are more than enough books and online docs that teach the basics of
> PHP and of course the native mysql commands.
>
> I'd now rather need a help to figure out how to pull up a wee bit more
> complex app.
> I know how to connect to a DB even though it might not be mysql. I can
> select stuff and dump it into a HTML table.
> Actually I prefer PDO and PostgreSQL.
>
> Is there a tutorial that teaches how to construct a app with a 2-column
> design.
> E.g. a menue frame on the left and a bigger content area on the right.
> So a click on a menue item would dynamically display a form or a list in the
> content area.

What you're asking has nothing to do PHP.  It's all UI and client
side.  That's all relative to:

* who are the visitors
* amount of information to be display
* type of application such as functions and features
* tools in your belt, ie: ajax, flash, etc...

to name a few and not necessarily in that order.

> What is a good way to glue everthing together between login and logout.
> I know cookies and sessions and I suspect those were a way to do it.
> How would I integrate a template system like smarty?
> It weren't bad if there were clues about AJAX, too.
>
> I'm in search of a way to extend the knowledge about bricks, tubes and
> cables to the wisdom to actually build a house out of those things.
>

More importantly, shouldn't you need to find out the properties of
each materials prior to building a house as it will affect the design
and structural integrity?  How strong is the brick?  What kind of
tubes?  Can they be easily bended?  What about prone to rust or
chemical reactions with long term exposure to chlorinated water?  What
cables are needed for each purpose and is the proper gauge of the
cable being used?  Insufficient gauge will lead to fire.  After you
have a firm understanding of the materials/technologies/skills
involved, then Google programming design patterns...

HTH,
Tommy

--- End Message ---
--- Begin Message ---

On 2011-11-25, at 7:38 PM, Andreas <[email protected]> wrote:

> Hi again,
> is there a tutorial for the structure of an php-app?
> 
> There are more than enough books and online docs that teach the basics of PHP 
> and of course the native mysql commands.
> 
> I'd now rather need a help to figure out how to pull up a wee bit more 
> complex app.
> I know how to connect to a DB even though it might not be mysql. I can select 
> stuff and dump it into a HTML table.
> Actually I prefer PDO and PostgreSQL.
> 
> Is there a tutorial that teaches how to construct a app with a 2-column 
> design.
> E.g. a menue frame on the left and a bigger content area on the right.
> So a click on a menue item would dynamically display a form or a list in the 
> content area.
> What is a good way to glue everthing together between login and logout.
> I know cookies and sessions and I suspect those were a way to do it.
> How would I integrate a template system like smarty?
> It weren't bad if there were clues about AJAX, too.
> 
> I'm in search of a way to extend the knowledge about bricks, tubes and cables 
> to the wisdom to actually build a house out of those things.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

Why not download some and dig into them? Something from sourceforge or a cms 
like pyrocms? See how they stuck it all together. 

Bastien Koert

--- End Message ---

Reply via email to