Re: FW: [PHP] What is an information_id in directory
Ernie Kemp wrote: 2 - Make a new content area in Site Manager->Content Manager. It doesn't matter what you put in your content area, you could just put "This is my new content area" or "Hello World" if you so choose. 3 - Grab the information_id of the new content area you made. When you are editing a content area that already exists, the information_id can be gotten from the update page URL. I'm having trouble understanding this request: 1. In item #2 the client wishes to put content here, I can only guess he means a file with text in it. ? 2. Item #3 I know what an ID is but not in this context. I'm don't understand what the client wishes here.?? Assuming that this is a site that is powered by a database, then one would be creating a new record in the database to store the content in rather than a new file, although one could get away with a list of files. The problem is you need to identify the next 'file/content' number, and that needs the 'information_id'. Using a database, there would be a unique index on the 'information_id' field, and you would just look up in the database to see if a number exists and pull the data from that record. Creating a new page just grabs the next 'information_id' number. One could get away by looking for the 'biggest' file number, but I suspect that 'Site Manager->Content Manager' already has some of the infrastructure to manage this? -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Array has `trailing comma`, why not the same for function parameter list?
It is convenient to have a trailing comma when defining an array - so as easy to add/remove code to add/remove an entry to the array array( 'key00' => 'value00', 'key01' => 'value01', 'key02' => 'value02', ... ) I suggest to PHP Development team to make it available in the syntax to have a leading comma array( ... , 'key00' => 'value00' , 'key01' => 'value01' , 'key02' => 'value02' ) in such way, we can thought of the leading commas as the list bulletings. And the same things would be lovely to be applied also to function parameter list. I don't see why not :) What do you thing about my suggestion? Hope to hear from you! -- Nam
[PHP] Dependency Injection Implementation
Hi everyone, Dependency Injection is a very trendy subject and after reading about it I kinda thought about rewriting the framework I'm doing with dependency injection. So I made my own implementation and was wondering what would you think about it? I have followed the article of Martin Fowler ( http://martinfowler.com/articles/injection.html) with this implementation I have the following : - you have both constructor and setter injection - the Dependency class is a service locator - we have at the same time service locator AND dependency injection - you can always manually inject dependency - you can pass arguments to the injected object constructor So: am I missing something? Do you think it's good enough? here is the code : _configuration = $configuration; } public function getConfiguration() { return $this->_configuration; } public function __isset($serviceName) { return isset($this->_serviceInstances[$serviceName]); } public function __call($serviceName, $args) { // singleton if (isset($this->_configuration[$serviceName]) && $this->_configuration[$serviceName]['singleton']) { if (!isset($this->_singletonInstances[$serviceName])) { $rc = new \ReflectionClass($this->_configuration[$serviceName]['class']); $this->_singletonInstances[$serviceName] = empty($args) ? $rc->newInstance() : $rc->newInstanceArgs($args); } $ret = $this->_singletonInstances[$serviceName]; } else { // normal if (isset($this->_setInstances[$serviceName])) { $ret = $this->_setInstances[$serviceName]; unset($this->_setInstances[$serviceName]); } else { $rc = new \ReflectionClass($this->_configuration[$serviceName]['class']); $ret = $this->_singletonInstances[$serviceName] = empty($args) ? $rc->newInstance() : $rc->newInstanceArgs($args); } } return $ret; } public function __get($serviceName) { return $this->__call($serviceName, array()); } public function __set($serviceName, $instance) { if (!is_object($instance)) throw new Exception('instance must be an object'); $this->_setInstances[$serviceName] = $instance; } } class DependencyInjectorException extends \Exception { } $di=DependencyInjector::getInstance(); $di->setConfiguration(array( 'database.connector'=>array( 'singleton'=>true, 'class'=>'DatabaseConnector' ), 'database'=>array( 'singleton'=>true, 'class'=>'Database' ) )); class DatabaseConnector{} class Database{ protected $_connector; public function __construct(){ $this->setConnector(DependencyInjector::getInstance()->{'database.connector'}); } public function setConnector($connector){ $this->_connector=$connector; } } class Test{ protected $_database; public function __construct(){ $this->setDatabase(DependencyInjector::getInstance()->database); } public function setDatabase($db){ $this->_database=$db; } public function getDatabase(){ return $this->_database; } } $test=new Test(); var_dump($test->getDatabase()); ?>
[PHP] Novice question
Hi I'm afraid I've fallen a little out of touch with PHP dev, so a stupid question for you. I want to write a script that requests a URL and then reads that website .. I'm interested to map web structures. My web host is saying I'll need URL file access enabled but that it's a) a security risk and b) deprecated. So .. what's the good / proper / acceptable / secure way of reading in URLs in PHP or .. isn't there one? Cheers J -- 01723 376477 Cost-free marketing: http://www.flowmarketing.co.uk/ Affordable marketing guidance for small businesses: http://www.amilliontweaks.co.uk/ Effective marketing services for SMEs: coming soon at http://www.surgemarketing.co.uk Professional Internet marketing consultancy: http://www.johnallsopp.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Novice question
Your question is NOT Novice and I really want to know the answer like you. On 10/30/11, John Allsopp wrote: > Hi > > I'm afraid I've fallen a little out of touch with PHP dev, so a stupid > question for you. > > I want to write a script that requests a URL and then reads that website > .. I'm interested to map web structures. My web host is saying I'll need > URL file access enabled but that it's a) a security risk and b) > deprecated. > > So .. what's the good / proper / acceptable / secure way of reading in > URLs in PHP or .. isn't there one? > > Cheers > J > > -- > 01723 376477 > > Cost-free marketing: http://www.flowmarketing.co.uk/ > > Affordable marketing guidance for small businesses: > http://www.amilliontweaks.co.uk/ > > Effective marketing services for SMEs: coming soon at > http://www.surgemarketing.co.uk > > Professional Internet marketing consultancy: http://www.johnallsopp.co.uk > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Novice question
> I want to write a script that requests a URL and then reads that website > .. I'm interested to map web structures. My web host is saying I'll need > URL file access enabled but that it's a) a security risk and b) > deprecated. simplehtmldom is pretty great for this, if I understand your needs correctly... also not sure about it's server setting requirements, but worth a look.. http://simplehtmldom.sourceforge.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Novice question
On 2011-10-30, at 2:45 PM, Marc Guay wrote: >> I want to write a script that requests a URL and then reads that website >> .. I'm interested to map web structures. My web host is saying I'll need >> URL file access enabled but that it's a) a security risk and b) >> deprecated. > > > simplehtmldom is pretty great for this, if I understand your needs > correctly... also not sure about it's server setting requirements, but > worth a look.. > > > http://simplehtmldom.sourceforge.net/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Another option is cURL www.php.net/curl Bastien Koert 905-904-0334 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend Amf and Drupal?
Silence ? I havn't got any responses from drupal.org, and i think its very quiet here too? Should I start to analyze the code to understand the inner workings? Can anyone give some advise on where to get more information? Or... is there another proven way to communicate between Flash and PHP/Drupal? Regards Lars Nielsen lør, 29 10 2011 kl. 12:53 +0200, skrev Lars Nielsen: > Hey List, > > I am making a webservice in Drupal with AMF Zend to provide some methods > to a Flash app. I have now managed to use standard Drupal services > (node,user and files) and I have made my own method to create users. > But! ... When I try to pass on arguments from Flash to Drupal it fails. > It says that it expects zero arguments but I have provided 4 arguments. > > I have posted some info here : http://drupal.org/node/1323678 > > Can you give me some guidelines? or pointers on what to do? > > Kind Regards > Lars Nielsen > www.lfweb.dk / www.gearworks.dk > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] function.session-start in Webmaster Tools
Hello all. Not sure just how much of this is PHP related, but hoping someone has come across this before. I Google's webmaster tools for a site I work on, they list more than 100 crawl errors for pages with URL's as follows: http://mydomain.com/My-Directory/function.session-start Can anyone explain why webmaster tools is seeing pages with links ending in "function.session-start"? I read up on the error itself... sometimes caused by whitespace before the session_start tag... have fixed that. Any info is appreciated. --Rick
Re: [PHP] Novice question
On Sun, 30 Oct 2011 17:24:07 - "John Allsopp" wrote: > Hi > > I'm afraid I've fallen a little out of touch with PHP dev, so a stupid > question for you. > > I want to write a script that requests a URL and then reads that > website .. I'm interested to map web structures. My web host is > saying I'll need URL file access enabled but that it's a) a security > risk and b) deprecated. > > So .. what's the good / proper / acceptable / secure way of reading in > URLs in PHP or .. isn't there one? cURL is the best one in my experience, but you have to manage security yourself. Meaning: Remember to escape/encode data. http://php.net/manual/en/book.curl.php > Cheers > J > > -- > 01723 376477 > > Cost-free marketing: http://www.flowmarketing.co.uk/ > > Affordable marketing guidance for small businesses: > http://www.amilliontweaks.co.uk/ > > Effective marketing services for SMEs: coming soon at > http://www.surgemarketing.co.uk > > Professional Internet marketing consultancy: > http://www.johnallsopp.co.uk > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function.session-start in Webmaster Tools
On Sun, Oct 30, 2011 at 4:30 PM, Rick Dwyer wrote: > Hello all. > > Not sure just how much of this is PHP related, but hoping someone has come > across this before. > > I Google's webmaster tools for a site I work on, they list more than 100 > crawl errors for pages with URL's as follows: > > http://mydomain.com/My-Directory/function.session-start > > Can anyone explain why webmaster tools is seeing pages with links ending in > "function.session-start"? I read up on the error itself... sometimes caused > by whitespace before the session_start tag... have fixed that. Any info is > appreciated. > Off the top of my head, check to make sure your robots.txt is in order, see http://www.robotstxt.org/robotstxt.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array has `trailing comma`, why not the same for function parameter list?
On Sun, Oct 30, 2011 at 8:47 AM, Nam Gi VU wrote: > It is convenient to have a trailing comma when defining an array - so as > easy to add/remove code to add/remove an entry to the array > > array( > 'key00' => 'value00', > 'key01' => 'value01', > 'key02' => 'value02', > ... > ) > > I suggest to PHP Development team to make it available in the syntax to > have a leading comma > array( > ... > , 'key00' => 'value00' > , 'key01' => 'value01' > , 'key02' => 'value02' > ) > in such way, we can thought of the leading commas as the list bulletings. > > And the same things would be lovely to be applied also to function > parameter list. I don't see why not :) > > What do you thing about my suggestion? Hope to hear from you! > WRT functions: while I could see how this would seem like a good idea because of the symmetry in what's going on at a very high level of abstraction, I would be against including it in a language. I don't particularly like it for arrays, but it does make it easy to add items into an array, which happens pretty often in development, especially when writing exploratory code. Function signatures, on the other hand, probably aren't changing nearly as often. At the very least, I wouldn't want to encourage people to make functions with many parameters, as it's normally a sign of poor design. This wouldn't explicitly do so, but would do so implicitly as it's only real purpose is to make it easier to add things. As far as the supporting-a-leading-comma thing goes, I'm pretty ambivalent on it. I don't really like the style outside of Haskell code, but that's just a preference. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php