CodeIgniter Forums
Discontinued - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Discontinued (/showthread.php?tid=18290)

Pages: 1 2 3 4 5 6 7 8 9 10


Discontinued - El Forum - 05-06-2009

[eluser]The Wizard[/eluser]
[quote author="Shanto" date="1241627057"]Thanks herrkaleun, Its greate![/quote]

thank you for testing Smile

the next release will be better Smile


Discontinued - El Forum - 05-08-2009

[eluser]steward[/eluser]
Hey this is very cool.

Only I don't want my table prefix in the controller names and so forth.

So I changed your list of links for each table into a form, with a checkbox for each table name, and some extra fields for what I want to name my stuff.


Code:
function_select()
{
...
        $this->load->helper('form');
        $rows='';
        foreach ($tables as $table)
        {
            $rows .= form_checkbox(
                                array(
                                'name'    => 'NAMETABLE',
                              'value'   => $table,
                                'checked' => FALSE,
                                'style'   => ''
                                ) );
            $rows .= " $table<BR />\n";
        }
        $form='';
        $form .= form_open('generate/ProcessTable/process');
        $form .= $rows;
        $form .= form_input('gen[NAMEMODEL]', 'MyModel');
        $form .= "<BR />\n";
        $form .= form_input('gen[NAMEVIEW]', 'MyView');
        $form .= "<BR />\n";
        $form .= form_input('gen[NAMECONTROLLER]', 'MyController');
        $form .= "<BR />\n";
        $form .= form_submit('submit','gen');
        $form .= form_close();
        echo $form;
    }

    function ProcessTable ( $table_name )
    {
        $table_name    = $this->input->get_post('NAMETABLE');
        $gen                = $this->input->get_post('gen');

$name_controller     = ucfirst( strtolower( $gen['NAMECONTROLLER'] ) );
$name_view                = ucfirst( strtolower( $gen['NAMEVIEW'] ) );
$name_model                = ucfirst( strtolower( $gen['NAMEMODEL'] ) );
$name_model_lower    = strtolower( $name_model );

echo '<PRE>';
print_r($gen);
echo '</PRE>';
echo "<BR>table_name=$table_name";
echo "<BR>name_controller=$name_controller";
echo "<BR>name_model=$name_model";
echo "<BR>name_view=$name_view";
die('<P>end');

... you have doubled up "$table_name" to also be the controller name etc.

In the next release, if you set those variables at the top of the ProcessTable() function, and separate out the subsitutions for table_name from NAMECONTROLLER etc, then we can modify it to suit our needs faster. As it is, we sorta gotta hunt through your code.

Also needs some documentation, maybe just a little more blurb on the welcome page.

Ie:

Look in the /templates folder to see create your own output.
The following substitutions are made during generation:

%FIELDS_ID%
%FIELDS_STRING%
%MODEL_CALL%
%NAME_CONTROLLER%
%NAME_MODEL%
%NAME_MODEL_LOWER%
%NAME_VIEW_FORM%
%SET_RULES%
%SET_VALUE%
%TABLE_NAME%
%VALIDATION_FALSE%
%VALIDATION_TRUE%
%VALUES_INIT%
%VALUES_INIT_EDIT%

It's a great idea and a good start. Thanks!


Discontinued - El Forum - 05-08-2009

[eluser]The Wizard[/eluser]
Steward: thank you very much for your interest.
We will have a look at all suggestions these days,
since exams hunt me Smile

i will definitely have a look at your suggestion and
making the modifying easier.

take care and thanks again Smile


Discontinued - El Forum - 05-09-2009

[eluser]steward[/eluser]
Having slept on it, it is probably better to have an INI or INCLUDE file...

NAMECONTROLLER=MyController
NAMEVIEW=MyView
etc
or
define ('%NAMECONTROLLERR', 'MyController');
...

-saves your code from being cluttered by form handling. Bloat-free.
-just as easy for us developers to modify.
-same result, allows us to specify/fine-tune details.

Either way, the main thing is to collect your assignments into one place, so it is obvious which variables we can set.

Good luck with your exams.


Discontinued - El Forum - 05-09-2009

[eluser]Dreammaker[/eluser]
> Having slept on it, it is probably better to have an INI or INCLUDE file…

Inch by inch we go to yml Smile


Discontinued - El Forum - 05-09-2009

[eluser]The Wizard[/eluser]
Smile hehehe

hello again.

the whole idea is, if you have a database design, and no written code, you run the database trough iScaffold, and you have a basic application to work on.
i however, included templates in the folder, where you can change everything to work with everylib or way you have.

since i believe, there is not much to do in terms of updating a crud engine (except for a major CI release) you could safely modify the templates or add your own
so every flavour would fit it, with or without yml or any other templating system Smile


Discontinued - El Forum - 05-11-2009

[eluser]tekhneek[/eluser]
I had this idea last night -- I've been using codeigniter for about a week and a half now or so and I thought to myself surely the majority of projects I create that use a database are going to be very similar in their CRUD layout.

I thought about using XML to explain relationships between the database, and codeigniter to do some similar code generation as you have in your script.

For example:
Code:
<layout>
  <schemas>
    <table>
      ...
      <relationship foreign_key="photos.fk_photo_id" primary_key="photos.id">photos</relationship>
      ...
    </table>
  <schemas>
</layout>

You get the gist, I haven't sat down and planned out the XML language to do this 100% but I know that it wouldn't take very long and it could be extended to form complex database relationships with minimal code. For example you could generate the CI structure with 100% database support (say you're editing the photos in a photo gallery, etc.)

Imagine being able to design the entire database, then create an XML file FROM that database. Create uniform database design conventions and you could almost create entire images/scripts/xml/sql that could create a project in seconds. Include the SQL and XML instructions, load it into the CI CRUD generator and v'oila, 90% done, now just customize. My only worry is that this would become too "frontpagesque" with users having the ability to create "cool stuff" with minimal, or relatively no working knowledge of the actual CI framework which is not what I would want.

Let me know if I can help contribute on google code, or I'll just modify your source and post it back here Wink


Discontinued - El Forum - 05-11-2009

[eluser]The Wizard[/eluser]
hello tekhneek,
we've almost a release ready.

please modify the existing source and provide an example in your free time.
im sure everyone would be glad Smile


Discontinued - El Forum - 05-14-2009

[eluser]The Wizard[/eluser]
Hello friends, the code has been updated for easier modification and a cleaner look.

take care


Discontinued - El Forum - 05-14-2009

[eluser]tekhneek[/eluser]
AWESOME! will check it out later.