PHP Widget Library and more

Coding Critique is the place to post source code for peer review by other members of DevNetwork. Any kind of code can be posted. Code posted does not have to be limited to PHP. All members are invited to contribute constructive criticism with the goal of improving the code. Posted code should include some background information about it and what areas you specifically would like help with.

Popular code excerpts may be moved to "Code Snippets" by the moderators.

Moderator: General Moderators

Post Reply
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

PHP Widget Library and more

Post by yacahuma »

Hello,

I have been using the same chunks of code for a long time. They served me well. I decided to create
a library out of them. I have many thing that I will be including but I want you guys to take a look and what I have so far. I am including a link of a working sample and a link to the code.


My idea is to have something extremely flexible so that you can mix html and the library or just use the library.
I have table with pagers and other cool stuff( at least for me)

I will soon include a link to download the actual libraries but I want you to see first what the coding looks like in a real example. I am going to start using the library for my work so I will update it often.

If I dont get positive feedback then I use it myself and dont waste the time making it so that someone else can use it.

Thank you

The link is here. Check the link below for the code


http://www.stccorp.net/stclib/test2.php
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post by jmut »

Well I have thought of such library myself..problem with it is there is no clear distinction between views - the templates or whatever you call them and other code. Just the thing is designer should know php as you build all widgets dynamically... For example what will you need to insert div between two input fields in your example...
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

I use classes that follow the same basic design.
(#10850)
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

code example

Post by yacahuma »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


jmut,

The basic idea is that a form has fields. If you want to insert something between the 2 just use a STCContent. You dont have to use a form either, you could just also draw each individual object.

Code: Select all

$f1 = new STCText();
$f2 = new STCText();
$d1 = new STCContent('<div>whaterever</div>');

$f = new Form();
$f->setElements(array($f1,$d1,$f2));

I do have more stuff that I have not converted yet from my chunks of code.

If you are a person that works with the normal EDIT,LIST,ADD, from a database, this library will make it really easy to do.
I have code generators that, for example , will generate all the code require to call a full Store procedure library. If you do this by hand is very time intensive. I have another code generator that if you pass the database it will create the objects and the pages using the library. And then you can just costumize it.


I will put more examples later.


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

added jason calendar

Post by yacahuma »

I just added a jason calendar (a nice javascript based calendar) Also now every element can tell the parent if it needs a javascript library so that the page can generated and the user of the library does not need to know.

Same link
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

New page for the library

Post by yacahuma »

I created a new page for the library. I also updated some of the files.

http://www.stccorp.net/stclib.html
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

added a pager to the table and a client side validator

Post by yacahuma »

Hello,

I just added a pager to the table and a client side validator. I also updated the test so you can see the pager
and validator working. As always comments are welcome.

Come on people!!! Shoot me down or say how cool it is. I need feedback.

Thank you
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post by jmut »

small Feedback: :)
:lol:

I think it's great idea for single dev/designers...not sure how great idea is when designer doesn't know much php..most of the case....then with you widget thingy he will need to build stuff using php....
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

oracle stub generator

Post by yacahuma »

I just added an oracle store procedure stub generator. It is very simple but it really makes coding faster. Everytime I have to call a store procedure with a bunch of parameter, I will type something wrong. With this tool it is a breeze.


the code specs a store procedure spec not the full body. If you have a spec that does not work, contact me and I will try to fix it. So far I coded only what I use.
Post Reply