php-general Digest 6 Nov 2009 07:26:50 -0000 Issue 6429

2009-11-05 Thread php-general-digest-help

php-general Digest 6 Nov 2009 07:26:50 - Issue 6429

Topics (messages 299649 through 299674):

How do I get reliable COMPUTERNAME?
299649 by: Andrew Ballard
299658 by: Jim Lucas
299662 by: Andrew Ballard

Re: Plotting a Line Graph
299650 by: cool.hosting4days.com

Re: Creating a Dynamic PHP/CSS Page (newbie design question)
299651 by: Ashley Sheridan
299652 by: Shawn McKenzie
299653 by: Shawn McKenzie
299654 by: Andrew Ballard
299656 by: tedd
299660 by: cool.hosting4days.com
299663 by: Shawn McKenzie
299664 by: Ashley Sheridan
299667 by: tedd

Re: Should I care about these errors?
299655 by: tedd
299657 by: Robert Cummings

Re: Imagick question
299659 by: Ashley M. Kirchner
299661 by: Ashley Sheridan
299665 by: Ashley M. Kirchner

Re: Custom function for inserting values into MySQL
299666 by: Daevid Vincent

Re: Free tech talk by Percona tonight in Palo Alto, CA
299668 by: Michael Shadle
299670 by: Sam Ghods

question about smarty
299669 by: Sudhakar
299674 by: Fernando Castillo Aparicio

Function Not Working...Little help
299671 by: Don Wieland

Re: Why getcwd() returs different results?
299672 by: Raymond Irving

Preview button to show PDF without submitting post data?
299673 by: Dave M G

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
I want to store the name of the computer that is executing a script in
some log tables. (Our servers are load balanced, and I'd like to be
able to determine which physical machine is serving each request.)

On my development machine (Windows PC running the debugger in Zend
Studio), I can find the name in three places:

getenv('COMPUTERNAME')
$_ENV['COMPUTERNAME']
$_SERVER['COMPUTERNAME']

On the development server, only the first works; $_ENV and $_SERVER
both return NULL and throw an undefined index notice.

I'm concerned about the reliability of all of these methods, since it
seems that they are not always available and all three can be easily
overridden inside a script. However, I notice that the header
generated by phpinfo() remains correct even when I manually spoofed
all three values on my development machine. Is there a reliable way to
find this value?

Andrew
---End Message---
---BeginMessage---
Andrew Ballard wrote:
 I want to store the name of the computer that is executing a script in
 some log tables. (Our servers are load balanced, and I'd like to be
 able to determine which physical machine is serving each request.)
 
 On my development machine (Windows PC running the debugger in Zend
 Studio), I can find the name in three places:
 
 getenv('COMPUTERNAME')
 $_ENV['COMPUTERNAME']
 $_SERVER['COMPUTERNAME']
 
 On the development server, only the first works; $_ENV and $_SERVER
 both return NULL and throw an undefined index notice.
 
 I'm concerned about the reliability of all of these methods, since it
 seems that they are not always available and all three can be easily
 overridden inside a script. However, I notice that the header
 generated by phpinfo() remains correct even when I manually spoofed
 all three values on my development machine. Is there a reliable way to
 find this value?
 
 Andrew
 

Well, I looked at all the variables that are available.  Then I looked at the
data in the output of phpinfo().

The only place that I can find the information that you are looking for is
available in the PHP Configuration section and it is in the System 
information.

So, looking at the phpinfo() page, I noticed the first comment down had a
method/function for converting the output of phpinfo() into a multidimensional
array.  Taking the output of that users function, you can access the data the
data you are looking for.

So, here is a link to the phpinfo() page.

http://php.net/phpinfo

From there, get the function called phpinfo_array()

take the output of that and run it through the following set of commands.

$data = phpinfo_array(TRUE);
list(, $server_name) = explode(' ', $data['PHP Configuration']['System']);
print( $server_name );

This will give you what you are looking for.

Jim
---End Message---
---BeginMessage---
On Thu, Nov 5, 2009 at 2:03 PM, Jim Lucas li...@cmsws.com wrote:
 Andrew Ballard wrote:
 I want to store the name of the computer that is executing a script in
 some log tables. (Our servers are load balanced, and I'd like to be
 able to determine which physical machine is serving each request.)

 On my development machine (Windows PC running the debugger in Zend
 Studio), I can find the name in three places:

 getenv('COMPUTERNAME')
 

Re: [PHP] Imagick question

2009-11-05 Thread Ashley M. Kirchner

Brady Mitchell wrote:
I'm sure it can be done, but without seeing your code we can't really 
help.
   Easily solved.  From the PHP manual 
(http://www.php.net/manual/en/function.imagick-roundcorners.php):


 ?php

   $image = new Imagick();
   $image-newPseudoImage(100, 100, magick:rose);
   $image-setImageFormat(png);

   $image-roundCorners(5,3);
   $image-writeImage(rounded.png);
 ?

   That produces a nice transparent cornered image, as it should.  
However, try saving it as a JEPG instead.  Set the image format to 
'jpeg' and write it out as 'rounded.jpg' and you'll notice the corners 
are now black.


   I know JPEG doesn't support transparency, that's fine.  What I want 
is to change the black to white instead.


   -- A

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How do I get reliable COMPUTERNAME?

2009-11-05 Thread Jim Lucas
Andrew Ballard wrote:
 I want to store the name of the computer that is executing a script in
 some log tables. (Our servers are load balanced, and I'd like to be
 able to determine which physical machine is serving each request.)
 
 On my development machine (Windows PC running the debugger in Zend
 Studio), I can find the name in three places:
 
 getenv('COMPUTERNAME')
 $_ENV['COMPUTERNAME']
 $_SERVER['COMPUTERNAME']
 
 On the development server, only the first works; $_ENV and $_SERVER
 both return NULL and throw an undefined index notice.
 
 I'm concerned about the reliability of all of these methods, since it
 seems that they are not always available and all three can be easily
 overridden inside a script. However, I notice that the header
 generated by phpinfo() remains correct even when I manually spoofed
 all three values on my development machine. Is there a reliable way to
 find this value?
 
 Andrew
 

Well, I looked at all the variables that are available.  Then I looked at the
data in the output of phpinfo().

The only place that I can find the information that you are looking for is
available in the PHP Configuration section and it is in the System 
information.

So, looking at the phpinfo() page, I noticed the first comment down had a
method/function for converting the output of phpinfo() into a multidimensional
array.  Taking the output of that users function, you can access the data the
data you are looking for.

So, here is a link to the phpinfo() page.

http://php.net/phpinfo

From there, get the function called phpinfo_array()

take the output of that and run it through the following set of commands.

$data = phpinfo_array(TRUE);
list(, $server_name) = explode(' ', $data['PHP Configuration']['System']);
print( $server_name );

This will give you what you are looking for.

Jim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Creating a Dynamic PHP/CSS Page (newbie design question)

2009-11-05 Thread cool

SORRY FOR THE EXTRA 2 BAD pre SENDS (accident...)


Thank for all the help!

Getting there... as a baby step - I'm trying this:

(part of this is from - http://sperling.com/examples/pcss/)

1 - I created this style sheet page called css.php with these contents:



.test1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #0099FF;
font-size: 18px;
}

?php
header(Content-type: text/css);
$color = green;// --- define the variable
echo CSS
/* --- start of css --- */
.title-text
{
color: $color;  /* --- use the variable */
font-weight: bold;
font-size: 1.2em;
text-align: left;
}
/* --- end of css --- */
CSS;
?

-

2 - I created this test page called testcss.php with these contents:

PROBLEM: the 'test1' style shows up - but the 'title-text' doesn't  
seem to work

btw: even added this : media=screen from demo 
How do I get it to show up?

==



!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN  
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;

html xmlns=http://www.w3.org/1999/xhtml;
head
meta http-equiv=Content-Type content=text/html; charset=UTF-8 /
titleUntitled Document/title

link href=css.php rel=stylesheet type=text/css media=screen /
/head

body 
ptest span class=test1this/span/p

p class=title-textand this/p
/body
/html


===


Thanks,
c...@hosting4days.com






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Imagick question

2009-11-05 Thread Ashley Sheridan
On Thu, 2009-11-05 at 12:22 -0700, Ashley M. Kirchner wrote:

 Brady Mitchell wrote:
  I'm sure it can be done, but without seeing your code we can't really 
  help.
 Easily solved.  From the PHP manual 
 (http://www.php.net/manual/en/function.imagick-roundcorners.php):
 
   ?php
 
 $image = new Imagick();
 $image-newPseudoImage(100, 100, magick:rose);
 $image-setImageFormat(png);
 
 $image-roundCorners(5,3);
 $image-writeImage(rounded.png);
   ?
 
 That produces a nice transparent cornered image, as it should.  
 However, try saving it as a JEPG instead.  Set the image format to 
 'jpeg' and write it out as 'rounded.jpg' and you'll notice the corners 
 are now black.
 
 I know JPEG doesn't support transparency, that's fine.  What I want 
 is to change the black to white instead.
 
 -- A
 


Fill the background with white before you create the corners.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] How do I get reliable COMPUTERNAME?

2009-11-05 Thread Andrew Ballard
On Thu, Nov 5, 2009 at 2:03 PM, Jim Lucas li...@cmsws.com wrote:
 Andrew Ballard wrote:
 I want to store the name of the computer that is executing a script in
 some log tables. (Our servers are load balanced, and I'd like to be
 able to determine which physical machine is serving each request.)

 On my development machine (Windows PC running the debugger in Zend
 Studio), I can find the name in three places:

 getenv('COMPUTERNAME')
 $_ENV['COMPUTERNAME']
 $_SERVER['COMPUTERNAME']

 On the development server, only the first works; $_ENV and $_SERVER
 both return NULL and throw an undefined index notice.

 I'm concerned about the reliability of all of these methods, since it
 seems that they are not always available and all three can be easily
 overridden inside a script. However, I notice that the header
 generated by phpinfo() remains correct even when I manually spoofed
 all three values on my development machine. Is there a reliable way to
 find this value?

 Andrew


 Well, I looked at all the variables that are available.  Then I looked at the
 data in the output of phpinfo().

 The only place that I can find the information that you are looking for is
 available in the PHP Configuration section and it is in the System 
 information.

 So, looking at the phpinfo() page, I noticed the first comment down had a
 method/function for converting the output of phpinfo() into a multidimensional
 array.  Taking the output of that users function, you can access the data the
 data you are looking for.

 So, here is a link to the phpinfo() page.

 http://php.net/phpinfo

 From there, get the function called phpinfo_array()

 take the output of that and run it through the following set of commands.

 $data = phpinfo_array(TRUE);
 list(, $server_name) = explode(' ', $data['PHP Configuration']['System']);
 print( $server_name );

 This will give you what you are looking for.

 Jim


Close, but not quite what I need. On the Windows systems, the System
value is Windows NT [hostname] [build], so that just returns NT.
Thanks, though. :-) You never know when something like that might be
useful.

I found php_uname('n') which looks like it will return the information
I'm after without having to dissect strings, and it appears to work
just fine across platforms.

Andrew

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Creating a Dynamic PHP/CSS Page (newbie design question)

2009-11-05 Thread Shawn McKenzie
c...@hosting4days.com wrote:
 SORRY FOR THE EXTRA 2 BAD pre SENDS (accident...)
 
 
 Thank for all the help!
 
 Getting there... as a baby step - I'm trying this:
 
 (part of this is from - http://sperling.com/examples/pcss/)
 
 1 - I created this style sheet page called css.php with these contents:
 
 
 
 .test1 {
 font-family: Verdana, Arial, Helvetica, sans-serif;
 color: #0099FF;
 font-size: 18px;
 }
 
 ?php
 header(Content-type: text/css);
 $color = green;// --- define the variable
 echo CSS
 /* --- start of css --- */
 .title-text
 {
 color: $color;  /* --- use the variable */
 font-weight: bold;
 font-size: 1.2em;
 text-align: left;
 }
 /* --- end of css --- */
 CSS;
 ?
 
 -
 
 2 - I created this test page called testcss.php with these contents:
 
 PROBLEM: the 'test1' style shows up - but the 'title-text' doesn't seem
 to work
 btw: even added this : media=screen from demo 
 How do I get it to show up?
 
 ==
 
 
 
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 html xmlns=http://www.w3.org/1999/xhtml;
 head
 meta http-equiv=Content-Type content=text/html; charset=UTF-8 /
 titleUntitled Document/title
 
 link href=css.php rel=stylesheet type=text/css media=screen /
 /head
 
 body 
 ptest span class=test1this/span/p
 
 p class=title-textand this/p
 /body
 /html
 
 
 ===
 
 
 Thanks,
 c...@hosting4days.com

You need to do the header() before anything else.


-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Creating a Dynamic PHP/CSS Page (newbie design question)

2009-11-05 Thread Ashley Sheridan
On Thu, 2009-11-05 at 14:13 -0600, Shawn McKenzie wrote:

 c...@hosting4days.com wrote:
  SORRY FOR THE EXTRA 2 BAD pre SENDS (accident...)
  
  
  Thank for all the help!
  
  Getting there... as a baby step - I'm trying this:
  
  (part of this is from - http://sperling.com/examples/pcss/)
  
  1 - I created this style sheet page called css.php with these contents:
  
  
  
  .test1 {
  font-family: Verdana, Arial, Helvetica, sans-serif;
  color: #0099FF;
  font-size: 18px;
  }
  
  ?php
  header(Content-type: text/css);
  $color = green;// --- define the variable
  echo CSS
  /* --- start of css --- */
  .title-text
  {
  color: $color;  /* --- use the variable */
  font-weight: bold;
  font-size: 1.2em;
  text-align: left;
  }
  /* --- end of css --- */
  CSS;
  ?
  
  -
  
  2 - I created this test page called testcss.php with these contents:
  
  PROBLEM: the 'test1' style shows up - but the 'title-text' doesn't seem
  to work
  btw: even added this : media=screen from demo 
  How do I get it to show up?
  
  ==
  
  
  
  !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
  http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
  html xmlns=http://www.w3.org/1999/xhtml;
  head
  meta http-equiv=Content-Type content=text/html; charset=UTF-8 /
  titleUntitled Document/title
  
  link href=css.php rel=stylesheet type=text/css media=screen /
  /head
  
  body 
  ptest span class=test1this/span/p
  
  p class=title-textand this/p
  /body
  /html
  
  
  ===
  
  
  Thanks,
  c...@hosting4days.com
 
 You need to do the header() before anything else.
 
 
 -- 
 Thanks!
 -Shawn
 http://www.spidean.com
 


Like I mentioned in my first reply to this, you need to set the content
type of the output in css.php:

header(Content-Type: text/css);

That way, the server sends down the right headers to the agent that is
requesting the CSS. By default, PHP outputs a content type of text/html,
and your browser thinks it got HTML instead of CSS so does nothing.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Imagick question

2009-11-05 Thread Ashley M. Kirchner

Ashley Sheridan wrote:

Fill the background with white before you create the corners.

   Well, I tried that, with no luck.  This is my actual code:

 $width = 150;
 $height = 150;
 $im = new Imagick('original/' . $filename);
 $im-thumbnailImage($width, $height, true);
 $im-sharpenImage(50, 1);
 $im-setImageBackgroundColor('white');
 $im-roundCorners(5, 5, 7);
 $im-setImageFormat('jpeg');
 $im-writeImage('thumbnail/' . $filename);
 $im-clear();
 $im-destroy();

--
H | It's not a bug - it's an undocumented feature.
 +
 Ashley M. Kirchner mailto:ash...@pcraft.com   .   303.442.6410 x130
 IT Director / SysAdmin. 800.441.3873 x130
 Photo Craft Imaging   .  2901 55th Street
 http://www.pcraft.com . .  ..   Boulder, CO 80301, U.S.A. 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Custom function for inserting values into MySQL

2009-11-05 Thread Daevid Vincent
 

 -Original Message-
 From: Shawn McKenzie [mailto:nos...@mckenzies.net] 
 Sent: Thursday, November 05, 2009 6:14 AM
 To: Daevid Vincent
 Cc: 'Allen McCabe'; 'PHP General'
 Subject: Re: [PHP] Custom function for inserting values into MySQL
 
 Daevid Vincent wrote:
   
  
  -Original Message-
  From: Shawn McKenzie [mailto:nos...@mckenzies.net] 
  Sent: Wednesday, November 04, 2009 4:59 PM
  To: Daevid Vincent
  Cc: 'Allen McCabe'; 'PHP General'
  Subject: Re: [PHP] Custom function for inserting values into MySQL
 
  Daevid Vincent wrote:
  -Original Message-
  From: Shawn McKenzie [mailto:nos...@mckenzies.net] 
  Sent: Wednesday, November 04, 2009 6:20 AM
  To: Allen McCabe; PHP General
  Subject: Re: [PHP] Custom function for inserting values 
 into MySQL
 
  In your example, I would name my form inputs similar to name
  =data[user_id].
 
  Then you just pass the $_POST['data'] array to your function.
 
  -Shawn
 
  Allen McCabe wrote:
  You raise some good points. I always name my input fields 
  after the
  entity names ( eg. input type=hidden name =user_id 
  value= ?php
  echo $resultRow['user_id'] ?  ).
 
  I suppose I am still in the phase of learning efficiency, 
  and perhaps
  trying to 'get out it' by writing functions that I can 
  just call and
  pass parameters instead of fully learning the core concepts.
 
  I just think functions are so damn cool :)
 
 
  I'll echo what the others have said about the 
  parameters.  For me
  personally, if I am passing more than three parameters 
  (sometimes even
  three) I rethink my function.  I'm not sure what 
 you envision
  using this
  function for, but the approach I use for forms and 
  databases is always
  arrays.  I get an array from my forms, I insert that 
  array into the
  database, and of course I fetch arrays out of the 
  database.  These are
  all indexed the same with the index as the field name 
  of the table so
  it's easy.
 
 
  --
  Thanks!
  -Shawn
  http://www.spidean.com
 
 
 
  There are pro's and cons to this type of thing. In general 
  that is how I do
  it too, but you have to be aware of security and 
  organization. It's not
  always smart to expose your DB field names directly so you 
  might want to
  obscure them for some critical values. If your passing from 
  one controlled
  function/method to another then this isnt an issue so much. 
 
  I also follow the ruby/rails ideal where tables are plural 
  names (users)
  and classes are singular names (user.class.php). Tables 
  always have fields
  for 'id','created_on','timestamp','enabled'. Except in 
  'glue table' cases
  (1:n or n:m). Classes extend a base class which handles a 
  lot of the minutea
  including the magic __get() and __set() routines as well as 
  knowing what
  table they should be through introspection (ie. Their own 
  file name). 
  No need to name your fields as arrays. $_POST is already an 
  array. You've
  just added more complexity/dimensions. When you submit your 
  form just pass
  $_POST to your function instead. In the function, is where 
  you should do any
  normalizing, scrubbing and unsetting (as per good MVC ideology)...
 
  The way I normally do it I learned from the CakePHP 
 framework which is
  very similar to (I think an attempt at a clone of) Rails.  
  I'm not sure
  if they do it the same way in Rails, but as you were 
 mentioning, in a
  Cake view of a form they use the table name as the array name
  (name=Users[username]).  Internally to the framework 
 this may make
  things easier, but imagine you have a page with 2 or more 
 forms that
  update different tables, or if your form had some fields that 
  you wanted to check after submission but are not DB fields.  
  
  The $_POST array will ONLY contain the key/values for the FORM that
  contained the submit button.
  
  form name=form_add
  input type=text name=foo value=bar
  input type=submit name=action value=Add
  /form
  
  
  form name=form_update
  input type=text name=bee value=boo
  input type=submit name=action value=Update
  /form
  
  So if you click the 'Add' button, you get back: 
  $_POST['foo'] = 'bar', $_POST['action'] = 'Add'
  
  if you click the 'Update' button, you get back: 
  $_POST['bee'] = 'boo', $_POST['action'] = 'Update'
  
  where's the confusion? You can only submit one form on a 
 page at a time.
  
  Why would you use the entire POST array?
  
  Presumably, anything in the form is of some value to your 
 database and you'd
  want it. Otherwise why is it in the form?
  
 
 I guess I was going for multiple tables and not multiple 
 forms. Consider a form that takes input for a Users table 
 and a Groups table. As for the inputs not needed by the DB,
 there are too many examples I could give
 with lots of inputs, but here is the simplest example I can think of:
 
 username
 password
 captcha
 rememberme
 
 Presumably you don't need the 

Re: [PHP] Creating a Dynamic PHP/CSS Page (newbie design question)

2009-11-05 Thread tedd

At 8:16 PM + 11/5/09, Ashley Sheridan wrote:

On Thu, 2009-11-05 at 14:13 -0600, Shawn McKenzie wrote:

   Getting there... as a baby step - I'm trying this:

 

   (part of this is from - http://sperling.com/examples/pcss/)

 
  You need to do the header() before anything else.



I'm not ragging on you Ashley, but what he needs to do is follow the 
directions as outlined in my example.


I really find it frustrating when I take the time to make things as 
simple as possible and then have people who don't want to take the 
time to understand what's being presented to them.


He could have his entire problem solved if he would only read and 
follow the documentation instead of throwing stuff together as if it 
will somehow work.


This reminds me of my first memory when I was two years old. You see, 
I had a wagon and I wanted it to run like cars do. I knew that my 
wagon didn't have what it took to make it run, so I started throwing 
stuff into it in the hopes that somehow everything would come 
together and the wagon would automagically run.


Well... it didn't run!

So, I stopped trying to solve things that way when I was two. I'm 
just surprised how long it takes others to discover that simple fact.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Free tech talk by Percona tonight in Palo Alto, CA

2009-11-05 Thread Michael Shadle
On Tue, Nov 3, 2009 at 10:17 AM, Sam Ghods s...@box.net wrote:
 Hi all,

 I would like to invite everyone to a Box.net sponsored free tech talk (and
 free dinner!) in Palo Alto tonight on Goal Oriented Performance
 Optimization, given by Peter Zaitsev of Percona, the leading MySQL/LAMP
 performance consulting firm. Learn more about the event from our blog post
 http://blog.box.net/?p=1363 and RSVP here:

got any slides?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] question about smarty

2009-11-05 Thread Sudhakar
i am using smarty template engine at work place, following is the situation


i already have 1 template that has already been created example =
http://localhost/sites/template1.com this works fine

following is the folder structure i have for smarty on xampp

1. C:\xampp\htdocs\sites\template1.com where i have .htaccess index.php and
siteconf.php

2. C:\xampp\htdocs\sites\_templates\templates\template1


in the siteconf.php file there are all the major variables defined which are
accessed in other tpl file of the templates example in aboutus page,
contactus page etc of this template1

now i have created another template called template2 and this also has the
same structure

1. C:\xampp\htdocs\sites\template2.com where i have .htaccess index.php and
siteconf.php

2. C:\xampp\htdocs\sites\_templates\templates\template2


my question is the look and feel when i access
http://localhost/sites/template1.com and
http://localhost/sites/template2.com

is the same the only thing that needs to be done is for template2 when i
access http://localhost/sites/template2.com ONLY the header image should be
different compared to the header i have for
http://localhost/sites/template1.com this is the only change i need

i am not aware as to the php code i need to write so that when i access
http://localhost/sites/template2.com the header image changes and this new
header image remains for the entire pages of
http://localhost/sites/template2.com

presently in header.tpl of template1 is written as follows

{if strpos($Data.KEYWORD,rv rental) === false}
div class=header
style=background:url(images/header_{$siteData.COUNTRY3}.gif) no-repeat top
left;
{else}
div class=header
style=background:url(images/header_{$siteData.COUNTRY3}_rv.gif) no-repeat
top left;
{/if}
/div

so i need to chane the {if} {else} where i need to mention that if i am
accessing http://localhost/sites/template2.com then the header image should
be different.

any help will be greatly appreciated.

please advice.

thanks.


Re: [PHP] Free tech talk by Percona tonight in Palo Alto, CA

2009-11-05 Thread Sam Ghods

You can see the slides from the talk here:

http://assets.en.oreilly.com/1/event/27/Goal%20Driven%20Performance%20Application%20Paper.pdf


Sam Ghods
s...@box.net
Box.net - Vice President of Engineering
office: (877) 269-6736 ext. 60
fax: (650) 529-0392

On Nov 5, 2009, at 2:45 PM, Michael Shadle wrote:


On Tue, Nov 3, 2009 at 10:17 AM, Sam Ghods s...@box.net wrote:

Hi all,

I would like to invite everyone to a Box.net sponsored free tech  
talk (and

free dinner!) in Palo Alto tonight on Goal Oriented Performance
Optimization, given by Peter Zaitsev of Percona, the leading MySQL/ 
LAMP
performance consulting firm. Learn more about the event from our  
blog post

http://blog.box.net/?p=1363 and RSVP here:


got any slides?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Function Not Working...Little help

2009-11-05 Thread Don Wieland

Hello,

I am trying to get this function working but it gives me a PHP error  
(blank page):


function Validate_Page_Nav($LastPage, $ErrorPage) {

$trimmed = str_replace($staffroot, '', $_SERVER['SCRIPT_NAME']);
$resul = $db-query(SELECT * FROM Page_Access WHERE URI =  
'$trimmed') or die(failed to get access data);

$page_access = $resul-fetch_assoc();
$URI_access = explode(,, $page_access['User_Level']);

if($_SESSION['Last_Page'] != $LastPage}) {
		header(location: {$ErrorPage}?message=Unable to update user  
information.);

exit();
}

if(in_array($_SESSION['Staff_level'], $URI_access)) {
echo Access;
exit();
}else{
echo No Access;
		//header(location: {$ErrorPage}?message=Unable to update user  
information.);

exit();
}
}

Validate_Page_Nav(user_list.php, user_list.php);

There are parts of the code I was trying to debug.

Any help would be appreciated.

Don Wieland
D W   D a t a   C o n c e p t s
~
d...@dwdataconcepts.com
Direct Line - (949) 305-2771

Integrated data solutions to fit your business needs.

Need assistance in dialing in your FileMaker solution? Check out our  
Developer Support Plan at:

http://www.dwdataconcepts.com/DevSup.html

Appointment 1.0v9 - Powerful Appointment Scheduling for FileMaker Pro  
9 or higher

http://www.appointment10.com

For a quick overview -
http://www.appointment10.com/Appt10_Promo/Overview.html


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Why getcwd() returs different results?

2009-11-05 Thread Raymond Irving
Here's an example from the PHP website:

This demonstrates the behaviour:

?php
function echocwd() { echo 'cwd: ', getcwd(), \n; }
echocwd();
register_shutdown_function('echocwd');
?

Outputs:

cwd: /path/to/my/site/docroot/test
cwd: / 


http://php.net/manual/en/function.register-shutdown-function.php

It's a known problem but I can't see why this can't be fixed





From: Ashley Sheridan a...@ashleysheridan.co.uk
To: Raymond Irving xwis...@yahoo.com
Cc: PHP-General List php-general@lists.php.net
Sent: Thu, November 5, 2009 6:09:19 AM
Subject: Re: [PHP] Why getcwd() returs different results?

On Wed, 2009-11-04 at 17:36 -0800, Raymond Irving wrote: 
Hello,

The getcwd() method returns a different path when called from inside a 
shutdown function under Apache. On windows IIS it works just fine.

Can't this be fixed so that the path returned is consistent across servers? 

It would appear that PHP should set the CWD path before calling the shut down 
functions

__
Raymond Irving

What shutdown functions are you meaning? Do you have an example which shows the 
problem?


Thanks,
Ash
http://www.ashleysheridan.co.uk

[PHP] Preview button to show PDF without submitting post data?

2009-11-05 Thread Dave M G
PHP Users,

I have a page that generates a PDF document using PHP. It takes form
data filled in by the user to fill out the PDF

When the user clicks submit, it emails that PDF document to the
intended recipient.

However, I would like to add a preview function as well. But for a
variety of reasons, instead of submitting the form data through post and
re-filling all the fields with the selected data, I'd like to be able to
open a new window with an example PDF without actually submitting the form.

I think this might need JavaScript, but I'm not sure.

Is this possible?

Thank you for any advice.

-- 
Dave M G

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] question about smarty

2009-11-05 Thread Fernando Castillo Aparicio
I'm not sure where is the problem, but can't you just define every changing 
part in your template as variables and assign them as needed from php?

If you need to change the image url, just make it a variable, like in

background:url(images/{$img})

Then you just assign the variable as needed in each file:

//template1.php
$img = 'mi_image_1.gif';
$smarty-assign( 'img', $img );

//template2.php
$img = 'mi_image_2.gif';
$smarty-assign( 'img', $img );

That way you don't need to use the {if} inside smarty and make your template 
lighter.





De: Sudhakar sudhakarar...@gmail.com
Para: php-general@lists.php.net
Enviado: vie,6 noviembre, 2009 00:14
Asunto: [PHP] question about smarty

i am using smarty template engine at work place, following is the situation


i already have 1 template that has already been created example =
http://localhost/sites/template1.com this works fine

following is the folder structure i have for smarty on xampp

1. C:\xampp\htdocs\sites\template1.com where i have .htaccess index.php and
siteconf.php

2. C:\xampp\htdocs\sites\_templates\templates\template1


in the siteconf.php file there are all the major variables defined which are
accessed in other tpl file of the templates example in aboutus page,
contactus page etc of this template1

now i have created another template called template2 and this also has the
same structure

1. C:\xampp\htdocs\sites\template2.com where i have .htaccess index.php and
siteconf.php

2. C:\xampp\htdocs\sites\_templates\templates\template2


my question is the look and feel when i access
http://localhost/sites/template1.com and
http://localhost/sites/template2.com

is the same the only thing that needs to be done is for template2 when i
access http://localhost/sites/template2.com ONLY the header image should be
different compared to the header i have for
http://localhost/sites/template1.com this is the only change i need

i am not aware as to the php code i need to write so that when i access
http://localhost/sites/template2.com the header image changes and this new
header image remains for the entire pages of
http://localhost/sites/template2.com

presently in header.tpl of template1 is written as follows

{if strpos($Data.KEYWORD,rv rental) === false}
div class=header
style=background:url(images/header_{$siteData.COUNTRY3}.gif) no-repeat top
left;
{else}
div class=header
style=background:url(images/header_{$siteData.COUNTRY3}_rv.gif) no-repeat
top left;
{/if}
/div

so i need to chane the {if} {else} where i need to mention that if i am
accessing http://localhost/sites/template2.com then the header image should
be different.

any help will be greatly appreciated.

please advice.

thanks.



  

Re: [PHP] Preview button to show PDF without submitting post data?

2009-11-05 Thread Fernando Castillo Aparicio
You could just open in a new window a php script that generates the preview 
pdf with a content-type header for pdf.

header(Content-type: application/pdf);

Or if the preview pdf is not dinamic, just point the url to the pdf.

No javascript needed, just a link, o a submit button on a form with the
url as the action attribute. If you need it to open on a new window,
use target=_blank, or better target=pdf if you want consecutive
requests to open in the same window instead of a new one everytime.

Note: if you are not using transitional html and care about validation, the 
target attribute is not allowed. In that case you would need javascript to open 
a new window.





De: Dave M G mar...@autotelic.com
Para: PHP-General List php-general@lists.php.net
Enviado: vie,6 noviembre, 2009 04:58
Asunto: [PHP] Preview button to show PDF without submitting post data?

PHP Users,

I have a page that generates a PDF document using PHP. It takes form
data filled in by the user to fill out the PDF

When the user clicks submit, it emails that PDF document to the
intended recipient.

However, I would like to add a preview function as well. But for a
variety of reasons, instead of submitting the form data through post and
re-filling all the fields with the selected data, I'd like to be able to
open a new window with an example PDF without actually submitting the form.

I think this might need JavaScript, but I'm not sure.

Is this possible?

Thank you for any advice.

-- 
Dave M G

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php