Re: [PHP] Static utility class?

2013-09-05 Thread Micky Hulse
On Wed, Sep 4, 2013 at 11:07 PM, Robert Cummings rob...@interjinn.com wrote:
 I'll second Rodrigo's opinion, but would like to comment that the name of
 the class is misleading since it's called Singleton. The singleton pattern
 is used when you only ever want one instantiation of a class. In your case
 you are using static methods, the object never needs to be instantiated and
 so it doesn't fit this pattern. What you are creating is far more consistent
 with the utility pattern.

Ahhh, thanks so much for the clarification and details! That's very helpful.

I've updated my gist to reflect the pattern name:

https://gist.github.com/mhulse/6441525

Much appreciated. :)

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



Re: [PHP] Static utility class?

2013-09-05 Thread Micky Hulse
On Thu, Sep 5, 2013 at 12:15 PM, Robert Cummings rob...@interjinn.com wrote:
 Probably sufficient (and easier for typing) to just call it Utility since it
 follows the pattern but isn't the pattern itself :)

Good call! Updated the example code.

Thanks again! I really appreciate the help. :)

Cheers,
Micky

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



[PHP] Static utility class?

2013-09-04 Thread Micky Hulse
Hi all!

Example code:

https://gist.github.com/mhulse/6441525

Goal:

I want to have a utility class that contain utility methods which should
have the option of being called multiple times on a page.

I think my main goal is to avoid having to new things ... I don't really
need to create an instance here (there's no need for a constructor in this
case).

Question:

Is the above simple pattern a good way to have a class that calls static
methods?

To put it another way, is there any reason why I would not want to use the
above code?

Basically I want to wrap these simple functions in a nice class wrapper and
have the ability to call them without having to jump through more hoops
than is necessary.

Are there any pitfalls to writing a class like this? Or, is this the
standard way of writing a simple utility class for this type of situation?

Please let me know if I need to clarify my questions.

Thanks for your time?


Re: [PHP] Static utility class?

2013-09-04 Thread Micky Hulse
Thank you so much for the quick and very informative/educational
replies Stephen and David, I really appreciate it! :)

On Wed, Sep 4, 2013 at 12:36 PM, Stephen stephe...@rogers.com wrote:
 This sounds simply like a library of functions that are implemented using
 objects.
 Instantiate your static variables in the library file. Again, so that only
 happens once.

functions implemented using objects sounds like exactly what I want.
Just out of curiosity, and sorry in advance for my ignorance, but does
the code I posted fit that type of pattern? If not, what would I need
to modify and how would I call it?

Actually, I should probably spend some time Googling before I ask you
for more details. :D

On Wed, Sep 4, 2013 at 1:15 PM, David Harkness
davi...@highgearmedia.com wrote:
 I can't say if what you're thinking of will make a good utility class since 
 the code you posted is fake. If you post some examples of methods you want to 
 make static, we can give you pointers on which are good candidates and which 
 are best left to instance methods.

Sorry about the fake code. To be honest, I have not written the code
just yet ... I'm kinda wanting to find the perfect pattern before I
get too far down the rabbit hole (though, this is for some simple
utility functions, so refactoring things should be easy later on).

I'll be sure to post real code for any follow up questions.

For now, thanks to you guys, I have a ton to work with. Thanks again
for the pro advice!

Cheers,
M

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



Re: [PHP] Static utility class?

2013-09-04 Thread Micky Hulse
Thanks Stephen! I really appreciate the help! :)

In my PHP ventures over the years, I haven't made much use of static
variables/methods/properties ... I was thinking they might be useful
for this one bit of code, but based on your feedback (and David's) I
think I'll be heading down a different path.

Thanks again for the kick in the right direction!

Much appreciated!

Cheers,
Micky

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



Re: [PHP] Static utility class?

2013-09-04 Thread Micky Hulse
Hi Rodrigo, thanks for the help, I really appreciate it!

On Wed, Sep 4, 2013 at 5:55 PM, Rodrigo Santos
rodrigos.santo...@gmail.com wrote:
 Hi, first, sorry for the bad English.

Not bad at all! Very clear and well written reply (heck, it's better
than my native English writing), so thank you! :)

 Yes, at least, as far as I know, this is the perfect way to do what you want
 to do. Think like this: when you instanciate a class, you are allocating
 memory. If you don't need any information stored, then you don't need to
 allocate memory, right? So, it's is logic to have a class that you will call
 only one fragment when you need it, rather than load the entire class just
 for one method.

Interesting! That makes a lot of sense.

Now you've piqued my interests! :)

I was going to head down a different path, but you've inspired me to
further explore the use of static methods/properties/variables/other.

A part of me just wants to learn more about PHP OOP, and using static
members is something I've not explored much. Seems like a simple
functional utility class would be a good time to play and learn more.
:D

 Just be careful to organize your utility methods by by meaning. Don't put a
 method that make dating stuff and a method that write a random string in the
 same class. By doing so, you are breaking the object orientation purpose.

Excellent tip! Thank you Rodrigo! I really appreciate the tips/advice
and inspiration. :)

Have a great afternoon!

Cheers,
Micky

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



[PHP] PHP5 OOP: Abstract classes, multiple inheritance and constructors

2013-06-21 Thread Micky Hulse
Example/working code here:

https://gist.github.com/mhulse/5833826

Couple questions:

1. Is there anything wrong with the way I'm using the abstract class?
If so, how could I improve the logic/setup?

2. Is there a way for me to pass $foo to the parent class, from the
child, without having to ferry that variable through the abstract
class? In other words, is there such a thing as:

parent::parent::__construct($foo);

... I want to have my abstract class constructor do things, yet I'd
like to avoid having to repeat myself for when it comes to passing
constructor arguments from the child.

Any tips would be appreciated. Sorry if silly questions.

Thanks!
Micky

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



[PHP] Re: PHP5 OOP: Abstract classes, multiple inheritance and constructors

2013-06-21 Thread Micky Hulse
On Fri, Jun 21, 2013 at 12:54 PM, Micky Hulse
mickyhulse.li...@gmail.com wrote:
 2. Is there a way for me to pass $foo to the parent class, from the
 child, without having to ferry that variable through the abstract
 class?

I should mention, I'm working on some code where I don't have the
ability to modify the parent class.

I'd still like to know how to improve my demo code in general, but I'm
working on a project where the parent class is off bounds in terms of
modifying.

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



Re: [PHP] Re: PHP5 OOP: Abstract classes, multiple inheritance and constructors

2013-06-21 Thread Micky Hulse
Thanks for tips David! I'll play with your suggestion.

I've never used abstract methods, but if I'm understanding the code
you posted, they look pretty useful.

I may be back with questions.

Appreciate the help. :)

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



Re: [PHP] LightBox click detection

2013-06-16 Thread Micky Hulse
On Fri, Jun 14, 2013 at 8:52 AM, Tedd Sperling t...@sperling.com wrote:
 Here's the problem --  I need to count the number of times a user activates a 
 LightBox -- how do you do that?

If you're using Google Analytics, you can use click tracking:

https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide

I recently setup click tracking on lightbox open, close and various
other modal window bits/pieces for a metered pay wall system.

For example, within the lightbox/modal window open method:

[code]

// Track this lightbox instance:
window._gaq.push([
'_trackEvent',  // Method.
'Paymeter Lightbox',// Group.
'Lightbox OPEN group ' + count_txt, // Append count to action text.
count_txt + ' OPEN event'   // Prepend count to label text.
]);

[/code]

The advantage to using a common tool like analytics is that it's got a
ton of powerful ways to analyze the data.

Not sure the goal of your project, but I thought I would mention.

Cheers,
M

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



Re: [PHP] ?=$var?

2013-04-18 Thread Micky Hulse
On Thu, Apr 18, 2013 at 8:36 AM, Larry Martell
la...@software-horizons.com wrote:
 That was it. Thanks!!

Np. Glad it helped. :)

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



Re: [PHP] ?=$var?

2013-04-17 Thread Micky Hulse
It should still work. You might need to turn on the short tag option
in your conf file.

http://stackoverflow.com/a/2185331/922323

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



Re: [PHP] ?=$var?

2013-04-17 Thread Micky Hulse
On Wed, Apr 17, 2013 at 3:59 PM, Micky Hulse rgmi...@gmail.com wrote:
 You might need to turn on the short tag option
 in your conf file.

Sorry, ini file, not conf. Been a long day. :D

I guess I should have asked if short tags are turned on for your 5.3.3?

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



Re: [PHP] ?=$var?

2013-04-17 Thread Micky Hulse
Ah, I see now. Sorry, I must have read the original question wrong.

There's a good thread on stack about short tags:

Are PHP short tags acceptable to use?
http://stackoverflow.com/questions/200640/are-php-short-tags-acceptable-to-use

Which kinda links to the docs:

PHP tags
http://www.php.net/manual/en/language.basic-syntax.phptags.php

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



Re: [PHP] load rtf file

2012-09-03 Thread Micky Hulse
On Mon, Sep 3, 2012 at 3:52 PM, Tedd Sperling t...@sperling.com wrote:
 Maybe if I was on a Windoze machine, but I'm on a Mac.

What about TextEdit.app?

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



Re: [PHP] curl equivalent in PHP

2012-03-02 Thread Micky Hulse
Hello,

On Fri, Mar 2, 2012 at 8:07 AM, Jim Lucas li...@cmsws.com wrote:
 But on some of my servers, curl isn't enabled! Is there any equivalent
 code
 to  achieve the same?

I've used a combination of output buffering [1], readfile() [2] and
caching (specific to the framework I was using).

Simply, you could resort to:

?php readfile('http://www.google.com'); ?

Ofc, the links would need to be absolute in order for the assets to load.

Good luck!

Cheers,
Micky

[1] php.net/ob-start
[2] php.net/readfile

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



[PHP] Re: Insert new array after specific key in multidimensional array

2012-02-28 Thread Micky Hulse
On Tue, Feb 28, 2012 at 8:36 AM, Shawn McKenzie nos...@mckenzies.net wrote:
 Might be an easier way but this should work.  You can sort the $before =
 true out for yourself :-)

Hi Shawn, I've updated your function to do the $before bit:

https://gist.github.com/1928452#file_array_insert.php

I also set it up to merge the new array to the end if the key does not exist.

Out of all the examples I have found, your approach looks the cleanest
and the most compact.

I'm open to feedback.

Many thanks

Cheers,
M

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



Re: [PHP] Insert new array after specific key in multidimensional array

2012-02-28 Thread Micky Hulse
Hi Adam!

On Tue, Feb 28, 2012 at 2:05 PM, Adam Richardson simples...@gmail.com wrote:
 What would be the best way to insert $o_insert array into $o array
 after specified key?

Great question. :D

Quick answer: It's a Wordpress thang!

Long answer: I am working with WordPress and the theme that I am using
stores all of its settings in a multidimensional array... The WP admin
displays the contents of the array as a GUI and the order of the array
is what dictates the display order.

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



[PHP] Insert new array after specific key in multidimensional array

2012-02-27 Thread Micky Hulse
Howdy!

Example code:

https://gist.github.com/1928452

What would be the best way to insert $o_insert array into $o array
after specified key?

I hate to just ask for example code, but I can't seem to find the
perfect solution. :(

Many thanks in advance for the help!

Cheers,
Micky

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



Re: [PHP] Insert new array after specific key in multidimensional array

2012-02-27 Thread Micky Hulse
Thank you Eray! That's a cool approach. Testing code now. I will be
back with my results. :)

Thank you!!!

Cheers,
M

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



Re: [PHP] Insert new array after specific key in multidimensional array

2012-02-27 Thread Micky Hulse
Hi Xucheng,

On Mon, Feb 27, 2012 at 7:41 PM, xucheng helloworldje...@gmail.com wrote:
 Maybe you can trans the array into a xml tree , then modify its leaves .

Now that sounds like an interesting idea... I will have to research
that as an option. Thanks for tip! :)

@Eray,

I was not able to get your code to work on my array... After working
with it a little bit, I realized your idea was very similar to these
others that I have found (great minds think alike):

http://eosrei.net/articles/2011/11/php-arrayinsertafter-arrayinsertbefore
http://drupal.org/node/66183

Your suggestion, and the ones above, work great if I break out the
key, pass it directly, then add the key back to the original array.

I have updated my gist and also put the code here:

http://codepad.org/IY0y9Oy6

Could things be optimized, or is this an acceptable solution?

Thanks!

Cheers,
Micky

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



Re: [PHP] Arrays: Comma at end?

2012-02-08 Thread Micky Hulse
On Wed, Feb 8, 2012 at 9:58 AM, Larry Garfield la...@garfieldtech.com wrote:
 Drupal's coding standards encourage the extra trailing comma on multi-line
 arrays, for all the readability and editability benefits that others have
 mentioned.  We have for years.  Cool stuff. :-)

Yah, I love that syntax guideline/rule in Python (tuples and other
things). I will definitely start doing this in PHP for arrays.

I am just surprised that there wasn't an older version of PHP that did
not allow this... I must have picked up this habit via my JS coding
knowledge. :D

Thanks again all!

Cheers,
Micky

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



Re: [PHP] Arrays: Comma at end?

2012-02-08 Thread Micky Hulse
On Wed, Feb 8, 2012 at 10:08 AM, Robert Cummings rob...@interjinn.com wrote:
 JavaScript in Internet Crapsplorer spanks you on the bottom every time you
 have a trailing comma in a JS array. That may be where you picked up the
 aversion.

On Wed, Feb 8, 2012 at 10:10 AM, Micky Hulse rgmi...@gmail.com wrote:
 I am just surprised that there wasn't an older version of PHP that did
 not allow this... I must have picked up this habit via my JS coding
 knowledge. :D

Jinx! You owe me a Coke!!! :)

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



[PHP] Arrays: Comma at end?

2012-02-07 Thread Micky Hulse
Was there ever a time when having a comma at the end of the last array
element was not acceptable in PHP?

I just did a few quick tests:

https://gist.github.com/1761490

... and it looks like having that comma ain't no big deal.

I can't believe that I always thought that having the trailing comma
was a no-no in PHP (maybe I picked that up from my C++ classes in
college? I just don't remember where I picked up this (bad) habit).

I would prefer to have the trailing comma... I just can't believe I
have avoided using it for all these years.

Thanks!
Micky

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



Re: [PHP] Arrays: Comma at end?

2012-02-07 Thread Micky Hulse
Hi Ashley! Thanks for your quick and informative reply, I really
appreciate it. :)

On Tue, Feb 7, 2012 at 12:10 PM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:
 It's easy to add and remove elements without making sure you have to check 
 the trailing comma. It's also OK in Javascript to use the trailing comma, as 
 long as you don't mind things not working on IE, which is the only browser 
 that has issues with it. As far as PHP goes though, it's fine.

Makes sense, thanks!

Gosh, I wonder if I picked up this habit due to my JS coding
knowledge? Anyway, thanks for the clarification. :)

Have an awesome day!

Cheers,
Micky

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



Re: [PHP] Arrays: Comma at end?

2012-02-07 Thread Micky Hulse
On Tue, Feb 7, 2012 at 12:15 PM, Paul M Foster pa...@quillandmouse.com wrote:
 I've always avoided trailing array commas, but only because I was under
 the impression that leaving one there would append a blank array member
 to the array, where it might be problematic. Yes? No?

Yah, ditto! :D

In my few simple tests, using PHP5.x, the last comma is ignored.

Just feels strange to have avoided doing something for so long, only
to learn that it's something I need not worry about! :D

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



Re: [PHP] Arrays: Comma at end?

2012-02-07 Thread Micky Hulse
On Tue, Feb 7, 2012 at 12:19 PM, Micky Hulse rgmi...@gmail.com wrote:
 Yah, ditto! :D

$s = 'foo,bar,';
print_r(explode(',', $s));

The output is:

Array
(
[0] = foo
[1] = bar
[2] =
)

That's one instance where I know you have to be cautious about the
trailing delimiter.

I know, this is all noob stuff... Sorry. :D

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



Re: [PHP] Arrays: Comma at end?

2012-02-07 Thread Micky Hulse
On Tue, Feb 7, 2012 at 12:32 PM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:
 That's because it's not an array you've got the trailing delimiter on, it's a 
 string.

Right. Sorry, bad example.

it was just the one example I could think of where you could get an
empty element at the end of your array.

Clearly, apples and oranges though.

Thanks!
Micky

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



Re: [PHP] pathinfo function

2011-07-26 Thread Micky Hulse
On Tue, Jul 26, 2011 at 3:47 PM, Tim Streater t...@clothears.org.uk wrote:
 that I will get an error if I try to reference $info[extension] ??

From what I can tell via reading the docs:

The following associative array elements are returned: dirname,
basename, extension (if any), and filename.
http://php.net/pathinfo

Makes me think that if the extension does not exist, then the
extension key will not exist.

Looking like isset() (or array_key_exists) will be needed:

$foo = (isset($info['extension'])) ? $info['extension'] : '';

At least, that's my take on it. :)

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



Re: [PHP] Re: PHP frameworks

2011-07-21 Thread Micky Hulse
+1 for CI.

If you search the group archives, a little while back I asked about
micro PHP frameworks and got a ton of good replies.

So folks, how'z about a PHP framework with a built-in admin interface?
That would be pretty sweet. :)

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



Re: [PHP] Re: PHP frameworks

2011-07-21 Thread Micky Hulse
On Thu, Jul 21, 2011 at 5:21 PM, Jim Lucas li...@cmsws.com wrote:
 So, what would said admin interface allow you to administrate?

Your app models?

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



Re: [PHP] Re: PHP frameworks

2011-07-21 Thread Micky Hulse
On Thu, Jul 21, 2011 at 5:33 PM, Micky Hulse rgmi...@gmail.com wrote:
 Your app models?

More specifically, your app model data. :)

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



Re: [PHP] Re: PHP frameworks

2011-07-21 Thread Micky Hulse
On Thu, Jul 21, 2011 at 6:44 PM, Shawn McKenzie nos...@mckenzies.net wrote:
 A la CakePHP.  Will automagically build controllers and views for the
 admin of your tables/models if you wish.

Oooh, interesting! I will check out CakePHP! Thanks for tip! :)

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



Re: Re: [PHP] Your language sucks because...

2011-07-14 Thread Micky Hulse
On Thu, Jul 14, 2011 at 4:02 AM, Richard Quadling rquadl...@gmail.com wrote:
 My daughter (6 or 7 at the time) came up with T, M and E. I was
 abso-bloody-lutely amazed she managed to find a word starting with T,
 M and E.

What was the word?

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



Re: Re: [PHP] Your language sucks because...

2011-07-14 Thread Micky Hulse
On Thu, Jul 14, 2011 at 4:19 PM, George Langley george.lang...@shaw.ca wrote:
 He gave you a beautiful hint:

:: slaps self on forehead ::

I should've known!!! :D

Thanks!
Micky

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



Re: [PHP] What is a label?

2011-07-13 Thread Micky Hulse
They must mean labels as in general naming convention rules for
programming... Like not naming a variable/function label with a number at
the front.

Here's a page about variables:

http://www.php.net/manual/en/language.variables.basics.php

Variable names follow the same rules as other labels in PHP. A valid
variable name starts with a letter or underscore, followed by any
number of letters, numbers, or underscores. As a regular expression,
it would be expressed thus: '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'

But I agree though, it would be nice if label was defined somewhere
in the docs.

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



Re: [PHP] Your language sucks because...

2011-07-13 Thread Micky Hulse
Under the CSS section:

No way to modularize or programmatically generate lengths. Can't say:
{ width:50% - 2px; }

That's so true!! I wish I could do the above...

Oh, and why is the PHP section so damned long?!?

Good read, thanks. :)

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



Re: [PHP] caching problem

2011-06-28 Thread Micky Hulse
OP:

Can we see the methods in question?

Have you tried running the code on a different server/host?

Have you added any scaffolding to your methods in order to test your
caching theory? This would be the first thing I would try (i.e. create
random number (or whatever), concat with variable vals generated via
method, other.)

Sent from my iPhone

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



Re: [PHP] best ways to recruit volunteers for a PHP framework

2011-06-28 Thread Micky Hulse
+1 for GitHub or BitBucket.

I have not visited SourceForge for years... I just like using Git myself.

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



Re: Re: [PHP] iPhone sadness

2011-05-30 Thread Micky Hulse
The WebDesign-L has been around since early 1997... For as long as I
can remember, the policy (on all list-servs I post to) has been no
top posting and trim quotes.

Here's WD-L's policy page:

http://webdesign-l.com/policies/

Lot's of great info there...

Under the Message Body heading:

[[

Do not top-post; write your reply below the quoted portion(s) of the
message to which you are replying.[Hide]
Putting your reply above a quoted message makes it difficult for
others to know exactly which point you are replying to. Quoting
portions of the preceding message above your reply helps others follow
along.

Trim your replies. Avoid quoting the entire preceding post, and take
care not to include the list footer
When replying, quote only what is needed for context. While most
people will not remember the previous message verbatim, you should
assume that those interested have been following the thread and do not
need to reread the previous post to understand yours. Quoting the
entire message wastes bandwidth, annoys members, and makes the digest
hard to read.

Avoid over-trimming.
Include names, but not the email addresses, of persons being quoted,
relevant URLs, and enough of the original post so that readers know to
what and whom you’re responding. If you’re responding to several
posts, or to the thread in general, please say so.

]]

I personally try to follow all the rules on that page for all of the
list-servs I am a member of.

For personal e-mails, that's a different story... I have found that
most folks, that don't use list-servs, don't get inline replies and
bottom posting (with quote above reply).

Cheers,
Micky

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



[PHP] Need pro advice: Is Pear installed and/or setup correctly?

2011-05-27 Thread Micky Hulse
What do you think this means.

This code:

[code]

?php

ini_set('display_errors', 1);
error_reporting(E_ALL | E_STRICT);
include_once('Mail.php');
include_once('Mail_Mime/mime.php');

?

[/code]

Outputs these error messages:

http://pastebin.com/ZKtyELT1

But this code:

[code]

?php
require_once 'System.php';
var_dump(class_exists('System', false));
?

[/code]

Returns bool(true)

Looking at these docs:

http://pear.php.net/manual/en/installation.checking.php

... it says:

In every case, PEAR's php_dir should be in the include path. If not,
add it in your system's php.ini.

When viewing PHP info, I do not see php_dir in the include path (or
anywhere else... Nor do I see any reference to pear.)

My friend told me that the host said Pear is installed.

I tried adding a php.ini to the root of the server (I don't know much
about this host's setup... I am just helping a friend out) but that
did not seem to load.

I don't have shell access either.

Would it be safe for me to conclude that Pair is not setup properly?
Would it be a simple fix for the host to add Pear to the include path?
What else could I do to get Pear to work if I can't use a php.ini file
and/or ssh into the server and check/tweak/install packages?

Thanks so much!

Cheers,
Micky

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



[PHP] Re: Need pro advice: Is Pear installed and/or setup correctly?

2011-05-27 Thread Micky Hulse
On Fri, May 27, 2011 at 10:27 AM, Micky Hulse
mickyhulse.li...@gmail.com wrote:
 Would it be safe for me to conclude that Pair is not setup properly?

Haha, Pear the package, not the host. :D

http://www.pair.com/

Typo. My bad.

Also, what the heck does this mean:

It is not safe to rely on the system's timezone settings. Please use
the date.timezone setting, the TZ environment variable or the
date_default_timezone_set() function. In case you used any of those
methods and you are still getting this warning, you most likely
misspelled the timezone identifier. We selected 'America/New_York' for
'EDT/-4.0/DST' instead in /home/USER/public_html/test.php on line 6

Never seen that warning message before when including files... Like I
said, I know nothing about this host, but so far I am wondering if
they have things setup properly?

Thanks for listening.

Cheers,
Micky

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



Re: [PHP] Re: Need pro advice: Is Pear installed and/or setup correctly?

2011-05-27 Thread Micky Hulse
On Fri, May 27, 2011 at 12:06 PM, Philip Thompson
philthath...@gmail.com wrote:
 The host is apparently using PHP 5.3 - this message started to appear in
 this version. Use date_default_timezone_set() somewhere in your code to
 explicitly set your timezone. I'm in the central US, so I use
 'America/Chicago'. See the docs for more info.

Thanks Philip! I will give that a try. :)

Testing now...

Nice! That helped! :)

date_default_timezone_set('America/Los_Angeles');

Now all I got to do is convince my friend that the host needs to add
Pear to the include path (at least, I think this is the problem with
Pear).

Thanks again Philip!

Have a great day.

Cheers,
Micky

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



Re: [PHP] Re: Need pro advice: Is Pear installed and/or setup correctly?

2011-05-27 Thread Micky Hulse
Looks like the host changed my include path:

(include_path='.:/usr/lib/php:/usr/local/lib/php:/usr/local/lib/php/PEAR')

I am still getting file not found include errors.

I am guess that Mail.php and Mail_Mime/mime.php are extras that are
not installed.

This is my first time trying to use Pear. Normally I use other code
for sending emails with attachments...

I think my friend setup an e-mail form using this tutorial:

http://www.html-form-guide.com/email-form/php-email-form-attachment.html

He could not get it to work, and I am just trying to get it to work for him.

I will probably ditch the whole Pear idea and use something else.

I hate working for free! :D

Thanks for listening all.. Sorry to bug the list with my crud.

Cheers,
Micky

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



Re: [PHP] Re: Need pro advice: Is Pear installed and/or setup correctly?

2011-05-27 Thread Micky Hulse
On Fri, May 27, 2011 at 12:48 PM, Micky Hulse rgmi...@gmail.com wrote:
 Looks like the host changed my include path:
 I will probably ditch the whole Pear idea and use something else.

Well, actually, it looks like having PEAR on the include path did help.

Mail.php was found... It was Mail_Mime/mime.php that was not getting found.

This seems totally hackish, but I had to download Mail_Mime and put it
in the web root of my friend's server:

http://pear.php.net/package/Mail_Mime/download

And changed the Mail_Mime include path to point to the new location
and it worked.

What a headache. Lol.

Problem solved. Thanks for the help Philip, and thanks for listening all!

Have a nice day.

Cheers,
Micky

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



Re: [PHP] Bold links

2011-05-15 Thread Micky Hulse
Hi Tedd!

On Sun, May 15, 2011 at 4:41 PM, tedd tedd.sperl...@gmail.com wrote:
 I vaguely remember using b tags in the markup for SEO considerations with
 the idea that I was going to change them to strong with a search/replace.
 Unfortunately, that did not happen until now. Thanks for letting me know.

Hehe! I dig it! :)

I definitely dig your site btw. I have found several of the pages
helpful over the years.

Thanks for the good discussion.

Cheers,
Micky

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



Re: [PHP] Bold links

2011-05-10 Thread Micky Hulse
[OT]

Thanks for the informative reply Tedd.

I respect your opinion and I don't think my approach is more right
than yours. I am wondering if this is just a DTD thing. I always use
an HTML 4.01 strict DTD and have not used an XHTML doctype in ages.

As far as I can tell, the specs in XHTML say not recommended, but I
can't find similar text in HTML 4.01 specs.

bJenkins/b vs. span class=bazJenkins/span

... to me, the latter seems to be overkill.

b class=bazJenkins/b

I can't of many times I have done the above... If I need to hook into
the b or i I might just do this (for example):

div id=wrapperBob bJenkins/b/div

#wrapper b { do whatever here }

On Tue, May 10, 2011 at 7:41 AM, tedd tedd.sperl...@gmail.com wrote:
 As for me, I choose to never use b and i for anything PERIOD and to
 speak out against their use whenever I can. As for table in presentation,
 judgment, the b and i tags present more problems than they solve so I
 will continue to not use those tags and speak against them.

Looking at your site:

http://sperling.com/

Viewing the source code on your homepage, I see b used 15 times in
the body copy.

I am assuming that maybe you have no control over that portion of your
site due to the CMS you are using?

Could you imagine using strong in all those instances where you used
b? Don't you think that would be overkill?

Sorry to everyone for taking this so OT for the PHP list.

[/OT]

Micky

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



Re: [PHP] Bold links

2011-05-09 Thread Micky Hulse
On Mon, May 9, 2011 at 2:56 PM, tedd tedd.sperl...@gmail.com wrote:
 Really?
 How does the blind via readers, such as JAWS, understand what a B is?
 First, never use B -- or I for that matter.
 Second, use strong or em instead. Readers can understand and render
 STRONG and EMPHASIZED text, but not B and I text -- those tags mean
 nothing and that's the reason why they are not encouraged for use and even
 removed from XHTML.
 Third, if neither of those tags (i.e., strong or em ) work for you, they
 try using a class (or an id) with a css rule of:

[OT]

Tedd, it seems like you are spreading a little bit of mis-information here.

* i — was italic, now for text in an “alternate voice,” such as
foreign words, technical terms and typographically italicized text
* b — was bold, now for “stylistically offset” text, such as
keywords and typographically emboldened text (W3C:Markup, WHATWG)
* em — was emphasis, now for stress emphasis, i.e., something you’d
pronounce differently (W3C:Markup, WHATWG)
* strong — was for stronger emphasis, now for strong importance,
basically the same thing (stronger emphasis or importance is now
indicated by nesting) (W3C:Markup, WHATWG)

– http://html5doctor.com/i-b-em-strong-element/

Seems to me the original posted just wanted to stylistically offset
or bold the last name... I dunno, maybe I am wrong, but here's no
good reason to stress stronger emphasis on the last name.

There's a time and a place and a reason to use one over the other.

Also, I don't think b and i have been removed from XHTML... In
fact, they are not even deprecated in XHTML.

Ok, getting off of my soapbox now. :D

[/OT]

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



Re: [PHP] Bold links

2011-05-09 Thread Micky Hulse
On Mon, May 9, 2011 at 4:18 PM, Joshua Kehn josh.k...@gmail.com wrote:
 If you are only make the last name bold for stylistic purposes you should
 use CSS and a class. If you have text that needs to be emphasized or
 strongly put use the appropriate tags.

Hrmm, I personally don't think there is anything wrong with b in this case.

Span tag, or whatever (with a class, optionally, or however you prefer
to mark things up), would work too... but, IMHO, there is absolutely
nothing wrong with b.

To each their own I guess. :)

Cheers,
Micky

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



Re: [PHP] newbie - function is undefined

2011-04-01 Thread Micky Hulse
Maybe try:

echo 'getText(p1)';

I think that should work.

Good luck.

Cheers,
Micky

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



Re: [PHP] Howdy (new in here)

2011-02-15 Thread Micky Hulse
On Tue, Feb 15, 2011 at 2:00 PM, David Harkness
davi...@highgearmedia.com wrote:
 I use KR. I started with it just as shown but as monitors increased in size
 I stopped cuddling the else so it's now on its own line, aligning the if,
 elseif, and else nicely. One of the developers at my company uses the
 truly abominable Horstmann style which makes moving code around a serious

KR here, unless existing guidelines are in place... CodeIgniter
framework and ExpressionEngine wants folks to use Allman.

I use a programming lang called Objectscript at work, and it will give
an error if there is not space between the if and the first (...
For example:

if(...) -- errors out.

I have had to learn to put a space in there:

if (...)

So I don't forget, I do this for everything now... I actually kinda
like the breathing room now.

Speaking of spaces, I am not a fan of putting spaces around the argument:

if ( foo == baz ) {

I definitely prefer this:

if (foo == baz) {

More on spaces: I am so glad that most PHP folks I know use tabs for
indentation and not spaces! Oops, did I just go there? Oh no I didn't!

Good thread! Thanks for that link Tedd!

Cheers,
Micky

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



Re: [PHP] switch case madness

2011-01-19 Thread Micky Hulse
On Wed, Jan 19, 2011 at 6:45 AM, Joshua Kehn josh.k...@gmail.com wrote:
 On Jan 19, 2011, at 9:43 AM, Jay Blanchard wrote:
 [snip]
 ...
 [/snip]
 Imagine when there'll be the day when you do not have to code at
 all...just copy 'n paste snippets together in the order that you wish
 them to work in and Voila'! - instant web app.
 Th!!
 They have that. It's called Ruby on Rails.

CodeIgniter and/or Django (Python) are fun.

What about a middle of the road solution?

Google for php micro framework and/or python micro framework.

I have yet to use a micro framework myself, but I am looking forward
to playing around with one for one of my next PHP projects... I would
love to find one that has a decent micro templating system. :D

M

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



Re: [PHP] Re: Re: Need code like pastebin.org

2010-12-27 Thread Micky Hulse
On Mon, Dec 27, 2010 at 5:29 PM, Michelle Konzack
linux4miche...@tamay-dogan.net wrote:
 I have gotten some ideas and now I start coding my own stuff,  which  is
 more flexibel in design and such.

Hrmm, just found this info:

http://blog.dixo.net/2009/09/15/pastebin-org-considered-harmful/

So, I assume you are looking for something similar to this site:

http://pastebin.com/

This is a good project to start from if you are into using Python/Django:

https://github.com/bartTC/django-paste

There are other Python/django pastebin sites out there, for example:

The Django book Practical Django Projects has a section dedicated to
a code/paste  app. Here is the unofficial code from the book:

https://bitbucket.org/philgyford/practical-django-projects/src

Both of the above use Pygments, which is a pretty sweet syntax highlighter.

Cheers,
M

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



Re: [PHP] EE1 plugin code/htmlentities() question

2010-11-30 Thread Micky Hulse
Hi Richard! Thanks for the reply, I really appreciate the help. :)

On Tue, Nov 30, 2010 at 5:49 AM, Richard Quadling rquadl...@gmail.com wrote:
 I'm guessing that nbsp; is only valid in HTML.

 I see.

Ah, it looks like I need to be Googling for htmlentities and xml.

Thanks for tip!

 Not sure why / would be encoded as it isn't anything too special
 outside of the closing tag.

Hrmm, yah. That must be an EE-specific thing... IIRC, in EE1, the
slashes needed to be converted from entities to a / when coming out
of the DB?

Ah, here we go:

[[

The SLASH constant has been removed from the template parser, and
forward slashes are no longer converted to entities.

]]

- 
http://expressionengine.com/user_guide//development/conversion/syntax.html#general

Thanks again Richard! Much appreciated!

Cheers,
Micky

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



[PHP] EE1 plugin code/htmlentities() question

2010-11-29 Thread Micky Hulse
Hello,

I was looking at this ExpressionEngine plugin:

http://expressionengine.com/downloads/details/xml_encode/
Description: This plugin converts reserved XML characters to entities.
 It is used in the RSS templates.

... Curious about this code:

trim(str_replace(array('#47;', 'nbsp;'), array(/, '#160;'), $str));

The plugin author used the above bit of code in the return statement.

Just curious if their is any particular reason why one would want to
replace #47; and nbsp; with / and #160 respectively?

For example, I am writing a similar plugin which utilizes
htmlentities()... I guess I am just wondering if I should apply the
same code as above to my entity-converted string?

Thoughts?

Thanks!
Micky

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



Re: [PHP] Convert hex string to hex value?

2010-10-22 Thread Micky Hulse
Hi Adam! Many thanks for you quick reply and for the help. :)

On Thu, Oct 21, 2010 at 11:31 PM, Adam Richardson
 In your second example, you're directly inputing a hex number, so there's no
 issue.

Interesting... I wish I could just input the hex directly,
unfortunately I don't have that option. :(

Still trying to figure out how I can take this:

$base = '96989b';
my_method('0x' . $base);

... and make my method think (for a lack of a better word) it is this:

my_method(0x96989b);

Hmmm, I wonder if I am going about this all wrong.

 Hope you get some rest :)

Thanks Adam! I really appreciate your help!

Have a nice night.

Cheers,
Micky

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



Re: [PHP] Convert hex string to hex value?

2010-10-22 Thread Micky Hulse
On Thu, Oct 21, 2010 at 11:45 PM, Micky Hulse rgmi...@gmail.com wrote:
 Hmmm, I wonder if I am going about this all wrong.

OMG, too easy:

my_method(hexdec('0x' . $base))

How did I miss that!?! I could swear I tried that earlier.

Sorry to bug ya'll!

Cheers,
Micky

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




[PHP] Convert hex string to hex value?

2010-10-21 Thread Micky Hulse
Hi,

I must be tired because I can't figure this out... I am sure it is
something obvious.

I need to pass a hex value to a method, but I can't figure out how to
convert a hex string to a hex value.

For exmaple:

$base = '96989b'
my_method('0x' . $base)

The above does not work with my_method().

my_method(0x96989b)

The above works without any problems.

Any tips?

Many thanks in advance!

Micky

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



Re: [PHP] break out of ?php... midway thru' an if { } statement ?

2010-10-11 Thread Micky Hulse
If I understand the question correctly, I think the answer is yes.

Maybe something like this:



?php if ($AlertUser2success): ?

Normal HTML, or MT tags, here.

?php elseif ($foo == $bar): ?

Normal HTML, or MT tags, here.

?php else: ?

Normal HTML, or MT tags, here.

?php endif; ?



Alternative syntax for control structures
http://php.net/manual/en/control-structures.alternative-syntax.php

PHP Shorthand and Alternate Syntax: A quickie!
http://designerfoo.com/php-shorthand-php-alternative-alternate-syntax-a-quickie.html

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



Re: [PHP] 1984 (Big Brother)

2010-09-13 Thread Micky Hulse
On Mon, Sep 13, 2010 at 2:43 PM, chris h chris...@gmail.com wrote:
 How would you like the system to be aware of rather or not you're in the
 office?

On his way in to the office:

Motion sensing camera connected to a mechanical pointer stick aimed to
trigger the server power button.

On his way out of the office:

Clap on/clap off Clapper connected to computer power cable.

:D

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



Re: [PHP] 1984 (Big Brother)

2010-09-13 Thread Micky Hulse
On Mon, Sep 13, 2010 at 5:05 PM, Daniel Brown danbr...@php.net wrote:
    It would be cheaper to employ the same method used on some
 lawnmowers and required on Jet Skis and Skidoos: a cable with a clip
 worn by the rider.  The rider falls off, the cable releases from the
 vehicle, disengaging the throttle and cutting the engine.  The boss
 stands up, his entire infrastructure collapses, everyone's connections
 are closed, and all PCs subsequently catch fire.

Lol! That would make a great Dilbert and/or Farside cartoon. :)

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



Re: [PHP] Do you have some standard for defined the variable in program language?

2010-07-27 Thread Micky Hulse
Some style guides you might find interesting (the Code Igniter style
guide might be the most relevant to this discussion):

Django: Coding style
http://tinyurl.com/bn8jv8

ExpressionEngine: General Style and Syntax
http://tinyurl.com/dfh7fa

Flex: SDK coding conventions and best practices
http://tinyurl.com/3xphtd

CodeIgniter (EE 2.0 core framework): User Guide Version 1.7.2 General
Style and Syntax
http://snipurl.com/t32db

Python: Style Guide for Python Code
http://snipurl.com/zwfvo

Hths.

Micky

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



Re: [PHP] finding the web root

2010-06-08 Thread Micky Hulse
 $_SERVER['DOCUMENT_ROOT']
 although a post on the manual mentions some variability between
 environments.

$root = (array_key_exists('DOCUMENT_ROOT', $_ENV)) ?
$_ENV['DOCUMENT_ROOT'] : $_SERVER['DOCUMENT_ROOT'];

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



Re: [PHP] php photo galery

2010-05-18 Thread Micky Hulse
 If anyone has anything similar to this please let me know.

SlidesShowPro Director:

http://slideshowpro.net/products/slideshowpro_director/

You could use the Director API and create a PHP gallery with your own
code, or you could use the SlideShowPro flash player.

The Director interface is very easy to use. For a nominal fee, you can
have SSP site host Director for you, or you can host the software it
yourself.

Cheers,
M

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



Re: [PHP] PHP include security

2010-04-19 Thread Micky Hulse
Hi Michiel!

 One thing to keep in mind is that this one doesn't take eval() vs regular
 include execution time into account, in case you were still considering
 using it. According to this page, it's many times

I was still considering it... I mean, I am still exploring all my
options for the sake of the learning/coding experience.

 slower: http://blog.joshuaeichorn.com/archives/2005/08/01/using-eval-in-php/

Oh! Nice!

[[

The speed of eval
Besides security concerns eval also has the problem of being
incredibly slow. In my testing on PHP 4.3.10 its 10 times slower then
normal code and 28 times slower on PHP 5.1 beta1. This means if you
have to use eval, you should avoid using it inline in any performance
sensitive code. Any easy way to cancel the performance penality is to
create a function in eval and just call that, now an extra function
call does have some performance overhead but its pretty small and
depending on the design can be non-existant since you would be calling
some function anyway.

]]

Interesting. Great read. Thanks for linkage.

[ot] The article also mentions variable functions... I have never used
those before. They look very useful, esp. for a function callback.
Learn something new every day! :) [/ot]

Thanks again for you help Michiel! I really appreciate it. :)

Have a great day!

Cheers,
Micky

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



Re: [PHP] PHP include security

2010-04-18 Thread Micky Hulse
On Sun, Apr 18, 2010 at 10:23 AM, Michiel Sikma mich...@thingmajig.org wrote:
 I would prefer to use include() since it runs the code in the same context,
 ...snip...
 with your data rather than printing it right away.

Thanks for the reply Michiel, I really appreciate it. :)

For some benchmarks on the different types of inclusion
functions/language constructs, this page has some good info:

http://www.raditha.com/wiki/Readfile_vs_include

The results are interesting.

Thanks again! Have an excellent day.

Cheers,
Micky

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



Re: [PHP] PHP include security

2010-04-17 Thread Micky Hulse
Hi Michiel! Thanks for the help, I really appreciate it. :)

 It depends. What's exactly do you want to prevent? It doesn't seem like a
 ...snip...
 include, say, additional HTML content, use file_get_contents() instead.

Very good points. My goal was to write a plugin that would allow me to
include some static HTML template file and get the ?php include...?
tags out of my CMS template. With that said, I think the only people
using this code will be the developers of the templates, and not your
standard user.

I opted to use output buffering and readfile() for the speed, and
include() would be an option if developers want to execute the code in
the included file.

Would file_get_contents() be faster than readfile and output
buffering? Would using file_get_conents() and eval() be faster than
using include() and output buffering?

Without boring you all to death, I am mostly interested in learning
new stuff! I actually don't think anyone will use this code other than
myself. :D

But I definitely agree with all your points.

Thanks so much for you help!

Have a great day!
Cheers,
Micky

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



[PHP] Re: PHP include security

2010-04-17 Thread Micky Hulse
 What do ya'll think? Any suggestions?

Sorry for the duplicate posting... I had some problems signing-up for
the list. :(

Also, I moved my test code to sniplr:

http://snipplr.com/view/32192/php-security-include-path-cleansing/

TIA!

Cheers
M

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



[PHP] Include security?

2010-04-16 Thread Micky Hulse
Hi,

Code:

=

ob_start();
switch ($this-command)
{
   case 'include':
   @include($x);
   break;
   default:
   @readfile($x);
}
$data = ob_get_contents();
ob_end_clean();

=

The above code snippet is used in a class which would allow developers
(of a specific CMS) to include files without having to put php include
tags on the template view.

The include path will be using the server root path, and the include
files will probably be stored above the web root.

My question:

What would be the best way to clean and secure the include string?

Maybe something along these lines (untested):

$invalidChars=array(.,\\,\,;); // things to remove.
$include_file = strtok($include_file,'?'); // No need for query string.
$include_file=str_replace($invalidChars,,$include_file);

What about checking to make sure the include path is root relative,
vs. http://...?

What do ya'll think? Any suggestions?

Many thanks in advance!

Cheers,
Micky

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



Re: [PHP] Include security?

2010-04-16 Thread Micky Hulse
 if allow_url_include is turned off, you don't have to worry much about http,
 if '.' is a invalide char, you can't include *.php...
 the include path probably should be the inc(whatever the name)
 folder(not accessible from web) instead of the web root and '..'
 should be disallowed

Hi Ryan! Many thanks for your help, I really appreciate it. :)

How does this look:

http://sandbox.hulse.me/secure_inc_str.txt

How could my code be improved?

Thanks again for the help, I really appreciate it. :)

Cheers,
Micky

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



[PHP] PHP include security

2010-04-16 Thread Micky Hulse
Hi,

Code:

=

ob_start();
switch ($this-command)
{
case 'include':
@include($x);
break;
default:
@readfile($x);
}
$data = ob_get_contents();
ob_end_clean();

=

The above code snippet is used in a class which would allow developers
(of a specific CMS) to include files without having to put php include
tags on the template view.

The include path will be using the server root path, and the include
files will probably be stored above the web root.

My question:

What would be the best way to clean and secure the include string?

Maybe something along these lines (untested):

$invalidChars=array(.,\\,\,;); // things to remove.
$include_file = strtok($include_file,'?'); // No need for query string.
$include_file=str_replace($invalidChars,,$include_file);

What about checking to make sure the include path is root relative,
vs. http://...?

What do ya'll think? Any suggestions?

Many thanks in advance!

Cheers,
Micky

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



Re: [PHP] preg_replace_callback(), how to pass function argument/param?

2008-03-31 Thread Micky Hulse

Casey wrote:

What does mah_process_tags do anyway? XD


Ah, hehe... Oh, basically I am trying to write a plugin for the 
Textpattern CMS:


http://textpattern.com/

processTags() is a core TXP function... Basically, it parses any TXP 
template tags (txp:function_name atts=foo /).


Long story short, I am am modifying the processTags() function so that 
it looks for class methods when parsing template tags, vs. looking for 
regular functions.


Thanks again Casey! I really appreciate your help. :)
Cheers,
Micky

--
Wishlist: http://tinyurl.com/22xonb
Switch: http://browsehappy.com/
BCC?: http://snipurl.com/w6f8
My: http://del.icio.us/mhulse

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



[PHP] preg_replace_callback(), how to pass function argument/param?

2008-03-30 Thread Micky Hulse

Hi,

This is probably simple to answer for most of ya'll, but...

preg_replace_callback($f, 'mah_processTags', $text);

Besides the matches, how would I pass function args/param to 
mah_processTags()?


For example, I would like to do something like this:

preg_replace_callback($f, 'mah_processTags($arg1)', $text);
function mah_processTags($matches, $arg1) { ... }

Is this even possible? I just want to pass-in $arg1 along with the 
matches. :)


Possible?

Many thanks in advance!!!
Cheers,
Micky

--
Wishlist: http://tinyurl.com/22xonb
Switch: http://browsehappy.com/
BCC?: http://snipurl.com/w6f8
My: http://del.icio.us/mhulse

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



Re: [PHP] preg_replace_callback(), how to pass function argument/param?

2008-03-30 Thread Micky Hulse

Casey wrote:

preg_replace_callback($f, 'mah_processTags(\'$0\', $arg1)', $text);
Does this work?


Awww, does not seem to work. :(

But maybe I need to dink with the code a bit more...

I would like to avoid setting a global here. :D

Thanks for the help Casey! I will let you know if I get it working. I 
may just have to think of a different approach here.


Cheers,
Micky


--
Wishlist: http://tinyurl.com/22xonb
Switch: http://browsehappy.com/
BCC?: http://snipurl.com/w6f8
My: http://del.icio.us/mhulse

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



Re: [PHP] preg_replace_callback(), how to pass function argument/param?

2008-03-30 Thread Micky Hulse

Casey wrote:

Hmmm. I've searched around, and it seems that only a global would work :/


Thanks for the help Casey! I really appreciate it. :)

Yah, I think I will use a global for now... Until I can think of an 
alternative coding approach.


Have a good one!

Cheers,
Micky


--
Wishlist: http://tinyurl.com/22xonb
Switch: http://browsehappy.com/
BCC?: http://snipurl.com/w6f8
My: http://del.icio.us/mhulse

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



Re: [PHP] www. not working

2008-02-15 Thread Micky Hulse

Jim Lucas wrote:
If you are running Apache, you do realize that all of this can be done 
in Apache instead of PHP right?


.htaccess example:

# Power-up the rewrite engine:
RewriteEngine on
# Redirect all non-www traffic:
RewriteCond %{HTTP_HOST} ^mysite\.com [NC]
RewriteRule ^/?(.*)$ http://www.mysite.com/$1 [R=301,L]\

I like to always redirect to www or non-www... not both. I have read 
that this is good for SEO and/or SE's.


Cheers,
Micky

--
Wishlist: http://tinyurl.com/22xonb
Switch: http://browsehappy.com/
BCC?: http://snipurl.com/w6f8
My: http://del.icio.us/mhulse

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



Re: [PHP] variables

2007-08-19 Thread Micky Hulse

Augusto Morais wrote:

I want create a variable based in another variable. Example:


Maybe this will give you some ideas?:

http://us3.php.net/manual/en/language.variables.variable.php

Good luck!
Cheers,
Micky

--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] OT- why is network solutions more than godaddy?

2007-08-03 Thread Micky Hulse

I use and love http://www.namecheap.com/

8.88$, plus whois guard.

The control panel is great. Fast customer service.

Also, I personally would avoid mixing host and registrar.

Cheers,
M


--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] Re: Rules of Engagement

2007-07-29 Thread Micky Hulse

Tom Ray [Lists] wrote:
Well I think my only issue with it is that this is a group discussion 
...snip...

to the list by default.


I agree with Tom.

I ussually hit reply, and take a few seconds to delete all the emails 
except the list email -- not very hard. :)




--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] The Official OT Name Tedd's Grandson Thread

2007-07-26 Thread Micky Hulse

Congrats Tedd! :)

Cheers,
Micky

--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] PHP short tags: Questions

2007-07-13 Thread Micky Hulse

Hey Richard, thanks for the reply. I appreciate it. :)

Richard Lynch wrote:

http://php.net/


Yikes! I guess it was one of those RTFM question/answers! Lol. :D


#2 sounds awfully bogus to me...


Yeah... Hmm, now I am starting to wonder where I heard/read that. Maybe 
it was a co-worker. I am glad I asked here for clarification.



1 and 3 sure ought to cover it though.


Yep yep. Sounds good to me. Good enough reasons to think twice about 
using short tags.


Also, FYI for those interested, a list member mentioned (off-list) that 
shorthand tags are considered by many to be deprecated and have been 
on the verge of removal from the PHP language a few times in the past.


Interesting stuff. :)

Thanks again Richard and all.

Cheers,
Micky

--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



[PHP] PHP short tags: Questions

2007-07-12 Thread Micky Hulse

Hi,

I am trying to describe why php short tags failed to work on a server... 
here is my simplified explanation:


it had to do with the server settings... The short_open_tag directive 
in php.ini was set to 0.


Do you think that is an ok way to describe the problem to a technically 
literate non php coder?


Additionally, is there a good reference on the net that explains the 
differences between short open tags and normal open tags?


Main negative things I have read about short open tags:

1. Not as portable.
2. Security risk/less secure.
3. Will conflict with XML tags.
4. Other?

Thanks!
Cheers,
M

--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] PHP short tags: Questions

2007-07-12 Thread Micky Hulse

Hi Chris, thanks for the quick reply. I appreciate your help.

Chris wrote:

Sure.


Thanks. :)


1  3 definitely. No idea how it's a security risk.


Ah, great. Thanks for clarification.

I probably mis-read the info about it being a security risk.

Have a great day,
Cheers,
Micky

--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] help with multi dimensional arrays

2007-05-24 Thread Micky Hulse

Micky Hulse wrote:

Looks like you are missing a comma on line 3.


Doi, meant semi-colon, not comma... Lol.

Also, when I get PHP errors, if not obvious, I check the previous line 
also... If says something like error on line 7 I will look at both 
line six and seven.


Of course, depends on error message. Yadda yadda... I still feel like a 
dork for saying comma.


Hehe,
Cheers
M


--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] help with multi dimensional arrays

2007-05-23 Thread Micky Hulse

Looks like you are missing a comma on line 3.

James Lockie wrote:

I get a syntax error on strlen.


   $newTypes = array();
   $newTypes[0] = array();
   $newTypes[0][0] = Starting with
   $newTypes[0][1] = strlen( $newTypes[0][0] );





--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



[PHP] Remove domain: What do think of this approach?

2007-05-16 Thread Micky Hulse

Hi folks, I hope everyone is having a good week. :)

Let me cut to the chase... Basically, I need to get this:

http://www.site.com/folder/foo

To work like this:

$_SERVER['DOCUMENT_ROOT'].'folder/foo/file.ext';

For use with getimagesize() and a few other functions (trying to avoid 
possible open_basedir restrictions.) Here is what I got so far:


# Determine http type:
$http_s = ($_SERVER['HTTPS'] == on) ? 'https://' : 'http://';
# Get root path:
$from_root = str_replace($http_s.$_SERVER['SERVER_NAME'], '', 
http://www.site.com/folder/foo);

echo
$_SERVER['DOCUMENT_ROOT'].$from_root;
/*
** Output:
** /web1/httpd/htdocs/blogs/images/uploads
*/

So, do you think I can rely upon the above script? I have a feeling the 
answer will be no Or, anyone have any tips/improvements?


Thanks!
Cheers,
Micky


--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] Remove domain: What do think of this approach?

2007-05-16 Thread Micky Hulse

Micky Hulse wrote:

/*
** Output:
** /web1/httpd/htdocs/blogs/images/uploads
*/


Ooops, typed that wrong, example output should be:

/web1/httpd/htdocs/folder/foo

--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] Remove domain: What do think of this approach?

2007-05-16 Thread Micky Hulse

Robin Vickery wrote:

use parse_url()
http://www.php.net/parse_url
then append the 'path' part to document root ?


OMG, that looks like it will do the trick!

Jeez, how did I miss that. I feel like a dufus.

Are list members allowed at least one RTFM question per month? :D

Thanks Robin! I appreciate the help.

Have a great day/night.
Cheers,
Micky



--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] Making code public -- What steps to take? GPL?

2007-05-15 Thread Micky Hulse

Howdy,

I just wanted to say, to all who responded, many many thanks for the 
help. I greatly appreciate it. I have not made my decision just yet, but 
it has been great hearing the advice and reading about all the different 
options available... Well, anyay, thanks! This list has been a life 
saver. :)


Cheers,
Micky



--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



[PHP] Making code public -- What steps to take? GPL?

2007-05-13 Thread Micky Hulse

Hi,

I am in the process of writing a simple but useful plugin for a blogging 
application


Long story short, I want to give-back to the community (i.e. free 
plugin), but would like to make an attempt at retaining some credit if 
folks port/use to/in other scripts/blogs/cms apps.


Any tips or links ya'll could share with me?

Anyone have any /* comment blocks */ I could put in my code?

Something like this, for example:

/*
** THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY
** OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
** LIMITED   TO  THE WARRANTIES  OF  MERCHANTABILITY,
** FITNESSFORAPARTICULARPURPOSE   AND
** NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR
** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
** OR  OTHER  LIABILITY,  WHETHER  IN  AN  ACTION  OF
** CONTRACT,  TORT OR OTHERWISE, ARISING FROM, OUT OF
** OR  IN  CONNECTION WITH THE SOFTWARE OR THE USE OR
** OTHER DEALINGS IN THE SOFTWARE.
*/

Different verbiage, of course...

Or, should I just not worry about this?

Lol! I hope I am phrasing my question right... I have been up all night 
coding, so my brain is kinda mushy right about now. :D


Many TIA's!
Cheers,
Micky

--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] Making code public -- What steps to take? GPL?

2007-05-13 Thread Micky Hulse

Micky Hulse wrote:

Or, should I just not worry about this?


Well shux! I love it when I answer my own questions:

http://www.phpfreaks.com/tutorials/19/0.php

I blame it on lack of sleep!

The GNU GPL License sounds like what I need. :D

Cheers,
M



--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] Making code public -- What steps to take? GPL?

2007-05-13 Thread Micky Hulse

Daniel Brown wrote:

   If you want to retain some credit but don't care about
distribution/modification/redistribution, check out the MIT license (more
commonly referred to as the X or X11 license).  We're using it in a project


Ah, great tip! :D

I will definitely read-up on the MIT license after I get some zzZZzz's!

It sure does sounds like what I am looking for. ;)


that combines PHP and text-to-speech technology.  It allows people to
improve (or degrade) our code, but says that we should still get our names
at the top as the original authors.


Oh, wow! That sounds like a great project... and it is cool to hear what 
you/your team decided to use for licensing. :)


Many thanks Daniel! I really appreciate the help and advice.

Have a great day,
Cheers,
Micky


--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] Making code public -- What steps to take? GPL?

2007-05-13 Thread Micky Hulse

Hey! Tijnema! Thanks for the quick reply. :)

Tijnema ! wrote:

I'd say, don't worry too much about the license, just put your name on
top of the code, and some other nonsense, like:
You're allowed to use this code, as long as you leave above lines
intact., where above your credit is listed of course.


Ah, well, that does sound good too. I a mainly looking to keep my 
name/website somewhere in the comments. :D


Whichever route I end-up taking, it is definitely nice to hear what the 
pros prefer. ;)


Thanks again Tijnema!

Have a great day.
Cheers,
Micky




--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] Making code public -- What steps to take? GPL?

2007-05-13 Thread Micky Hulse

Crayon Shin Chan wrote:
Don't forget the MIT license allows people to incorporate your code into 
commercial products and sell for profit without having to give anything 
back (money/improved code/etc).


Hi Cayon, thanks for clarification.

I just woke up, so I have not had a chance to really research the best 
option for my code... Hmm, a part of me does not mind the things you say 
above, but another part of me wonders if it would be best to restrict 
the commercial usage of it.


Heheh, well, either way, thanks for the help. I appreciate it.

Have a great day.
Cheers,
Micky



--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] Making code public -- What steps to take? GPL?

2007-05-13 Thread Micky Hulse

Daniel Brown wrote:

   Right, I alluded to that, but perhaps I should've said that exactly, as
it may bother some people.  In my case, it doesn't bother me in the least,
just as I use LAMP (all open source) to make a living.


Oh, I think I understood that. But there is always room for 
clarifications. :D


Thanks Daniel,
Cheers,
Micky

--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] One class, many methods: PHP4.x: Q's

2007-05-12 Thread Micky Hulse

Hi Eric! Thanks for your reply. :)

Eric Butera wrote:

If at all possible you're going to want to use PHP5 if you're doing
...snip...
of those problems have been alleviated.


Gosh! I wish I could use PHP5... Unfortunately the hosting company I am 
using has not upgraded. I can not wait to start learning PHP5 OOP!



Also I would recommend always defining all of the class variables that
...snip...
variables and all of that.


Great! Good to hear. Thanks for the clarification. Very helpful. :)


The get and set method's you wrote are part of the concept of
encapulation.  Read this:
http://en.wikipedia.org/wiki/Information_hiding for more information.


Excellent! Thanks for link, very interesting.

Man, I love programming, I just wish I were better at it! Lol.

Anyway, that is why I am on this list... Feedback from the pros is great!

Many thanks Eric and all! I greatly appreciate your help.

Have a good one!
Cheers,
Micky


--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



[PHP] One class, many methods: PHP4.x: Q's

2007-05-10 Thread Micky Hulse

Hi,

This might be a real obvious question/answer... but I have been up all 
night geeking on code, so my mind is kinda mushy -- please be kind. :)


I have a class called Randimg. Within that class, I have several 
methods. Within a few of those methods, I use the below code snippet:


$_SERVER['DOCUMENT_ROOT']

What would be the best way to assign the above code to a global 
variable/constant within the class?


Also, within each method, I am returning error strings... I would like 
to create these as class constants... Or something... What is best way 
to setup static strings within my class? Basically, I would like to have 
these strings at the top of my class so potential users can easily 
change the settings. ;)


Lol, sorry is stpid questions... I am still kinda new to PHP OOP.

Many TIA's!
Cheers,
Micky

--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] One class, many methods: PHP4.x: Q's

2007-05-10 Thread Micky Hulse

Hi Rich! Thanks for the quick reply. I really appreciate your help. :)

Richard Davey wrote:
In PHP 5 could you create $docroot as a protected class constant, but in 
PHP 4 the above will have to do.


Ahhh! Very interesting. Many thanks for the code example and explanation 
-- that approach works for me.


I assume setting basic strings (i.e. settings) for my error messages 
would be best done via:


class Randimg
{

var $msg_1 = 'This is a string';
var $msg_2 = 'This is another string';

function rand_img() { echo $this-msg_1; }
function foo() { echo $this-msg_2; }

}

It just seems so extraneous to declare those strings as vars... A class 
constant sounds like the best approach.


I can't wait to start using PHP5! :D

Thanks again Rich! I really appreciate your time and expertise.

Have a great day and/or night.

Cheers,
Micky






--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] One class, many methods: PHP4.x: Q's

2007-05-10 Thread Micky Hulse
Hi Eric! Thanks for the fast reply. I really appreciate the help on this 
one. :D


Eric Butera wrote:

As Rich pointed out you cannot have constants within a class in PHP4.
To answer the second part of your mail, one technique that I have seen
is something like the code below.


Ahhh, that is interesting! Thanks for sharing the code snippet. I think 
I may head this direction. :)



Another way that is nice is Solar's way of handling locales.
Basically it uses strings such as 'SOME_ERROR_MESSAGE' which is
populated by an include file that contains the actual value to it.  So
in this include file you create an array that contains key value pairs
of error codes and error messages.


Oh, wow! That sounds interesting... I am going to catch some zzZZzz's 
and read-up on this in the morning. :D


Ahhh, and it looks like a cool framework too:

http://solarphp.com/

I may have to dip-into that. I have yet to try a PHP framework. Django 
was pretty fun, but I think I would have more fun with a PHP framework. :)


Anyway, thanks a billion for sharing different approaches, it is great 
to hear how the pros deal with such things.


Have a great day and/or night.
Cheers,
Micky

--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



Re: [PHP] One class, many methods: PHP4.x: Q's

2007-05-10 Thread Micky Hulse

Richard Davey wrote:
I don't know if that's the *best* way, personally I'd not really do it 
like that, but no-one can tell you it is 'right' or 'wrong' because it 
...snip...


Perfect answer! Thanks!

I do not have too many error messages to store, but I do like the 
constant approach... Looks like I have a bit of testing to do tomorrow 
(brain is mush atm.)


Thanks again Rich and Eric. :)

Cheers,
M


--
Wishlists: http://snipurl.com/1gqpj
   Switch: http://browsehappy.com/
 BCC?: http://snipurl.com/w6f8
   My: http://del.icio.us/mhulse

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



  1   2   >