how are methods handled?

83 views
Skip to first unread message

webpied

unread,
Oct 6, 2011, 1:10:50 PM10/6/11
to GluePHP
just using the starter code - how would i do this?

in browser location bar: www.asdf.net/class-name/method-name/ ?

in webpy it's just mapped verbose - '/login/sample(\d+)' => 'login/
sample',

hope i can learn to use glue.php - it's the most familiar looking to
this old python programmer :-D

tia,
greg

Joe

unread,
Oct 6, 2011, 1:54:56 PM10/6/11
to GluePHP
Hi Greg,

On Oct 6, 11:10 am, webpied <gmi...@gmail.com> wrote:
> just using the starter code - how would i do this?
>
> in browser location bar:www.asdf.net/class-name/method-name/ ?
>
> in webpy it's just mapped verbose - '/login/sample(\d+)' => 'login/
> sample',

In this way, Glue is limited to just specifying a single argument
(class name) on the right side of the array. The methods of the class
are limited to the HTTP method.

> hope i can learn to use glue.php - it's the most familiar looking to
> this old python programmer :-D

Glue was my personal solution to web.py but in PHP. I know it is not a
complete clone, but that's due to me trying to design it as bare and
simple as possible.

Thanks,
Joe

webpied

unread,
Oct 6, 2011, 1:59:20 PM10/6/11
to GluePHP
hi Joe, thanks for answering, so it basically handles each appending
argument as an extension (case/switch or conditional)?
url: /about-us/history/
class: explode($url... *ka-boom*
$url[1] == 'about-us'
$url[2] == 'history' (but as a variable)?

does glue have a sample app somewhere - like a todo app or something -
anything with some guides for setting up classes??

thanks for the clues.

Joe

unread,
Oct 6, 2011, 2:08:42 PM10/6/11
to GluePHP
Hi Greg,

On Oct 6, 11:59 am, webpied <gmi...@gmail.com> wrote:
> hi Joe, thanks for answering, so it basically handles each appending
> argument as an extension (case/switch or conditional)?
> url: /about-us/history/
> class: explode($url... *ka-boom*
> $url[1] == 'about-us'
> $url[2] == 'history' (but as a variable)?

The entire URL regex is scanned -- it does not get split up at all.
Unfortunately this can lead to a potentially long string of URLs if
you want to map each one to different classes:

/about-us/history => history
/about-us/contact => contact

etc

You could do:

/about-us/(.*).html => about_us

and add the logic to your about_us class.

> does glue have a sample app somewhere - like a todo app or something -
> anything with some guides for setting up classes??
>
> thanks for the clues.

Unfortunately documentation is sparse. Besides the mini-tutorial on
the gluephp.com webpage, there are two undocumented docs:

http://gluephp.com/glueandsmarty.html -- needs rewritten to use the
more modern Twig template system.
http://gluephp.com/index.txt -- GluePHP's index.php source code that I
posted for a past discussion on Reddit.
http://gluephp.com/set_env.txt -- required file for the above.

Thanks,
Joe

webpied

unread,
Oct 6, 2011, 3:48:07 PM10/6/11
to GluePHP
cool - i've been looking through the prepend file you (class includes)
and googling them.

why twig and smartypants? just curious.

i'm kinda tired - brain has slowed down a lot, but i did get this far:

i am treating this as a whole string @the url now. so i'm making
progress.

it's feeling like python (now) - after a str_ireplace to put spaces
where the slashes were, and an explode to an array - i have some
workable variables now.

$urls = '/(L|R|P)+(\d+)' => 'reports', <--- i need the first char to
be a capitol L,R, or P and the rest digits... i have an app on my
screen called RegexBuilder - i'm not sure it's luckily i escaped
learning regex this long haha - i'm hoping i can figure it out after
some sleep.

the code to break the url string apart is:
$url_setup = str_ireplace('/',' ',$reports);
$url_explode = explode(" ", (string)$url_setup);

atm, the explode is useless, but the output isn't bad - just strips at
the letter "L" o.0
str_ireplace => Array
(
[0] => L33334 343234 234234
[1] => L
[2] => 343234
[3] => 234234

i'm going to be using a PDO pattern for db (in PHP), any chance you
have an example for implementing a db class? if not, i'll just toss
it in there and instantiate it and 'wing it' :-D

Thanks Joe,
Greg


On Oct 6, 2:08 pm, Joe <joetopj...@gmail.com> wrote:
> Hi Greg,
>
> On Oct 6, 11:59 am, webpied <gmi...@gmail.com> wrote:
>
> > hi Joe, thanks for answering, so it basically handles each appending
> > argument as an extension (case/switch or conditional)?
> > url: /about-us/history/
> > class: explode($url... *ka-boom*
> > $url[1] == 'about-us'
> > $url[2] == 'history' (but as a variable)?
>
> The entire URL regex is scanned -- it does not get split up at all.
> Unfortunately this can lead to a potentially long string of URLs if
> you want to map each one to different classes:
>
> /about-us/history => history
> /about-us/contact => contact
>
> etc
>
> You could do:
>
> /about-us/(.*).html => about_us
>
> and add the logic to your about_us class.
>
> > does glue have a sample app somewhere - like a todo app or something -
> > anything with some guides for setting up classes??
>
> > thanks for the clues.
>
> Unfortunately documentation is sparse. Besides the mini-tutorial on
> the gluephp.com webpage, there are two undocumented docs:
>
> http://gluephp.com/glueandsmarty.html -- needs rewritten to use the
> more modern Twig template system.http://gluephp.com/index.txt-- GluePHP's index.php source code that I
> posted for a past discussion on Reddit.http://gluephp.com/set_env.txt-- required file for the above.
>
> Thanks,
> Joe

webpied

unread,
Oct 6, 2011, 4:39:44 PM10/6/11
to GluePHP
i think i got the regex... that app makes it easy to see what matches,
but not sure of the savvy to know i want what it says i have... haha

http://173.255.231.216/L33567833/234234234234/237777734234234/


On Oct 6, 2:08 pm, Joe <joetopj...@gmail.com> wrote:
> Hi Greg,
>
> On Oct 6, 11:59 am, webpied <gmi...@gmail.com> wrote:
>
> > hi Joe, thanks for answering, so it basically handles each appending
> > argument as an extension (case/switch or conditional)?
> > url: /about-us/history/
> > class: explode($url... *ka-boom*
> > $url[1] == 'about-us'
> > $url[2] == 'history' (but as a variable)?
>
> The entire URL regex is scanned -- it does not get split up at all.
> Unfortunately this can lead to a potentially long string of URLs if
> you want to map each one to different classes:
>
> /about-us/history => history
> /about-us/contact => contact
>
> etc
>
> You could do:
>
> /about-us/(.*).html => about_us
>
> and add the logic to your about_us class.
>
> > does glue have a sample app somewhere - like a todo app or something -
> > anything with some guides for setting up classes??
>
> > thanks for the clues.
>
> Unfortunately documentation is sparse. Besides the mini-tutorial on
> the gluephp.com webpage, there are two undocumented docs:
>
> http://gluephp.com/glueandsmarty.html -- needs rewritten to use the
> more modern Twig template system.http://gluephp.com/index.txt-- GluePHP's index.php source code that I
> posted for a past discussion on Reddit.http://gluephp.com/set_env.txt-- required file for the above.
>
> Thanks,
> Joe

Kendall Arneaud

unread,
Jul 30, 2013, 6:00:06 PM7/30/13
to glu...@googlegroups.com
I too was looking for a way to use class-name/method 

I saw we push for this to be added to the features for Glue. Nice framework BTW
Reply all
Reply to author
Forward
0 new messages