Henri Bergius wrote:

> Greetings!
> 
> I decided to take another approach to the Snippet
> spec and try to create an example implementation
> of interoperable snippets, and then work on the
> actual spec based on that.
> 
> However, there is an issue I'm thinking of:
> 
> Is there a smart way to check whether a specific
> Snippet is installed to the system, based on the
> snippet path?


How do you define "a smart way" ?

There are several ways, I don't know if they're smart though...

1 - walk the snippet path (probably the only way with PHP3)
    call the function mgd_get_snippetdir_by_path("/path/to/the") then 
call the function mgd_get_snippet_by_name("snippet")
    this function returns a snippet object.

2 - test the return of the function mgd_snippet("/path/to/the/snippet") 
(available in PHP4 only, not documented cause it's part of the preparser 
mechanism)
   This one only returns the code field of the snippet, so it can be a 
little more efficient than the first one.

3 - we could implement a function 
mgd_snippet_exists("/path/to/the/snippet") that would return a boolean 
value (cheap and easy, can be implemented in both PHP3 and PHP4)

> 
> /Bergie
> 


-- 
Best Regards,
David Guerizec           Free Software Developer
Aurora R&D               [EMAIL PROTECTED]
Midgard core developer   http://www.midgard-project.org/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to