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):


 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;
}



-

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?

==



"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

http://www.w3.org/1999/xhtml";>


Untitled Document





test this

and this




===


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):
> 
>
> $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  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;
> }
> 
>  header("Content-type: text/css");
> $color = "green";// <--- define the variable
> echo << /* --- 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?
> 
> ==
> 
> 
> 
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";>
> 
> 
> Untitled Document
> 
> 
> 
> 
> 
> test this
> 
> and this
> 
> 
> 
> 
> ===
> 
> 
> 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;
> > }
> > 
> >  > header("Content-type: text/css");
> > $color = "green";// <--- define the variable
> > echo << > /* --- 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?
> > 
> > ==
> > 
> > 
> > 
> >  > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > http://www.w3.org/1999/xhtml";>
> > 
> > 
> > Untitled Document
> > 
> > 
> > 
> > 
> > 
> > test this
> > 
> > and this
> > 
> > 
> > 
> > 
> > ===
> > 
> > 
> > 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    .   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.
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 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 mul

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  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
>  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}

{else}

{/if}


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  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

 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:



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 
To: Raymond Irving 
Cc: PHP-General List 
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 
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}

{else}

{/if}


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 
Para: PHP-General List 
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