Welcome Guest, Not a member yet? Register   Sign In
  Need Help to integrate Codeigniter and Extjs
Posted by: El Forum - 04-19-2008, 12:14 PM - Replies (2)

[eluser]Unknown[/eluser]
Hi Friends,

I developed a Dynamic Taxonomy System using ExtJS . Now i want to port all Code to code igniter.

I have used Tree panel class in which on any even raised Ajax call is fired with a .php file which process at server side handles database processing.

For that i created a controller and view functions to handle this but its not working.


Help me how to integrate Extjs with Codeigniter.

There are just one topic avliable on this forum which does not contain more info or working example in detail.

Email me , Pm me or ping on [email protected], [email protected] or [email protected]

Thanks in advance.


  Guidance about developing a public application with lots of db's
Posted by: El Forum - 04-19-2008, 11:36 AM - Replies (3)

[eluser]kevinprince[/eluser]
Hey Guys,

Im starting to develop a new version of an existing CRM project for multi company use. The current version is specific to the business I built it for, but there is large demand for a similar solution within the specific industry.

One of my main thoughts I have had is how to handle version migrations with databases. I want to stick each customer on there own database, so that there data is kept separate. This means when I rollout an update to the application, I need to be able to do it to lots of db's at the same time.

Hope this is clear any advice appreciated.


  Django-like Template Inheritance Helper
Posted by: El Forum - 04-19-2008, 10:48 AM - Replies (8)

[eluser]Daniel Dornhardt[/eluser]
Hello everybody, I'm new to Code Igniter, but I already like it...

I am a PHP Programmer for only a little bit more than a year now, but I already tried different frameworks and approaches to structuring code...

I started porting a personal app to Code Igniter to check it out, and I really like it so far, but one thing I really liked when I tried the Django web framework was still missing:

Template inheritance.

So I created a helper to take care of that.

It also works for "Ungnited" PHP Code by the way.

I am actually not sure if everything is working as it should, especially concerning the loading of views from within views... I also didn't test it on PHP 4 yet, but I think it should work.

Comments are very welcome Smile

If someone can tell me how to produce proper linebreaks / paragraphs in the wiki, I'll prettify it later on.

Without further ado:

Template Inheritance Helper in Wiki

SHORT SYNAPSIS:

* Create a Master Template
* Mark some blocks in it
* Create some child templates
* extend Master Template
* do $this->load->view('child_template.php')
* multiple levels of inheritance. E.g. create a master template for the general page outline, extend that for different sections, and extend those section templates to include the final content

CONFIGURATION:

If you are using Code Igniter, you shouldn't have to do anything.

If not, you'll have to define a 'TI_VIEWS_DIR' constant, like

define ('TI_VIEWS_DIR', 'views/');

which should be a path where PHP can find your view files. You can make it relative
to the current PHP working dir or absolute, it shouldn't matter.

If you don't do this, you'll have add the path to your files to your extend() calls.

Then just include this file somehow. Code Igniter users can drop it into their 'helpers' - dir
and make sure that it gets loaded (via autoload or manually).

QUICK TUTORIAL:

Imagine you have a website with the same basic structure in every page. Something like this:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
    &lt;title&gt;
        Dan's Music Store
    &lt;/title&gt;
    &lt;link rel="stylesheet" href="css/base.css" type="text/css" media="all" /&gt;
&lt;/head&gt;
&lt;body id="body"&gt;
    <div id="container">
        &lt;!-- Content goes here --&gt;
    </div> &lt;!-- container --&gt;
&lt;/body&gt;
&lt;/html&gt;

Then you might have different subpages which actually use the same basic structure.

Now you can use PHP to include separate files for every area of that template, but
I always felt like this was a suboptimal solution.

So the idea is to put some kind of markers into the base template which can be extended from child
templates. We'll call it "main_template.php". An example could look like this:

main_template.php:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
    &lt;title&gt;

        &lt;? start_block_marker('title') ?&gt;
            Dan's Music Store
        &lt;? end_block_marker() ?&gt;

    &lt;/title&gt;

    &lt;? start_block_marker('extra_head') ?&gt;
        &lt;link rel="stylesheet" href="css/base.css" type="text/css" media="all" /&gt;
    &lt;? end_block_marker() ?&gt;

&lt;/head&gt;
&lt;body id="body"&gt;
    <div id="container">

        &lt;? start_block_marker('content') ?&gt;
            <h1>Welcome to the Dan's Music Store</h1>
            <p>Instruments from all over the world</p>
        &lt;? end_block_marker() ?&gt;

    </div> &lt;!-- container --&gt;
&lt;/body&gt;
&lt;/html&gt;

If you include just this, essentially you would get the same output as in the first example, because
no special block content has been assigned yet.

To use this file as a base template for different content, you have to use the extend() function
and start overriding the blocks of the base template. Let's call this one "guitars.php". It will be a
section template which includes some extra content for the guitar section of our music store.

guitars.php:
Code:
&lt;? extend('main_template.php') ?&gt;

    &lt;? startblock('title') ?&gt;
        &lt;?= get_extended_block() ?&gt;
        - Guitars
    &lt;? endblock() ?&gt;

    &lt;? startblock('extra_head') ?&gt;
        &lt;?= get_extended_block() ?&gt;
        &lt;link rel="stylesheet" href="css/guitars.css" type="text/css" media="all" /&gt;
    &lt;? endblock() ?&gt;

    &lt;? startblock('content') ?&gt;
        <h2>Look around!</h2>
        <p>Such a fine selection of Guitars!</p>
    &lt;? endblock() ?&gt;

&lt;? end_extend() ?&gt;

With extend('filename'), you tell this template which base template it should extend. You need to wrap
this file up with a call to &lt;? end_extend() ?&gt; to make the magic work.

You can call get_extended_block() to inherit / receive the content of the parent block,
which is useful for adding additional data to the base template.

In this example it's used to add a second part to the &lt;title&gt; - tag and to add an additional stylesheet.


  Field prefix when using join in active record
Posted by: El Forum - 04-19-2008, 10:27 AM - Replies (4)

[eluser]inari[/eluser]
This is my problem:

$q = $this->db->join('partners','partners.client = clients.id','left');
$q = $this->db->get('clients')->result();

Both tables have at least one field that has exact name. In this case there are fields called 'name', 'address', etc...

When I get output, fields with same name are overwritten.

Is there some way to use field prefix with codeigniter? So if there are two fields with same name that I can get one field like 'test_name', and other one like 'clients_name'

If not, is there some auto-aliases with mysql or something like that?

Only way I can use same field names now is that I white sql manually an use 'AS' alias.
But I can't use it with Active record.


  upload allowed_types issue
Posted by: El Forum - 04-19-2008, 08:19 AM - Replies (4)

[eluser]gRoberts[/eluser]
hi all.

One of my users has pointed out that when uploading he gets an error message. When i looked into this, I noticed he was uploading an excel (xls) file.

The problem is that the allowed_types is set to only allow CSV files, but it allows XLS. I have tried uploading an XML file or something else and CI throws an error as its not allowed.

Since when has .xls been the same as .csv?

Any idea's?

Gav


  tabindex for formfields using Form Helper?
Posted by: El Forum - 04-19-2008, 08:03 AM - Replies (4)

[eluser]5indies[/eluser]
hi, is there any way to use tab indexes with Form Helper in version 1.6.1?


  database drivers question
Posted by: El Forum - 04-19-2008, 07:54 AM - Replies (1)

[eluser]Thoer[/eluser]
I'm a bit afraid of asking another stupid question, but in the database config file it says:

Code:
|    ['dbdriver'] The database type. ie: mysql.  Currently supported:
                 mysql, mysqli, postgre, odbc, mssql
But isn't oci8, sqlite supperted too?


  active record nested queries
Posted by: El Forum - 04-19-2008, 07:44 AM - Replies (3)

[eluser]kylehase[/eluser]
Does the active record class support nested queries. For example:

Code:
insert into blogarchive select * from blog where date < 2006;
If so, how is this accomplished?


  Processing dynamic forms
Posted by: El Forum - 04-19-2008, 06:01 AM - Replies (5)

[eluser]KeyStroke[/eluser]
Hi,

I have a form that's used to approve uploaded images in bulk before displaying them on the site. Each image will have two radio buttons next to it: "approve" and "delete".

My question is how do you process this kind of forms? the names of the radio buttons constantly change depending on the image's ID in the database, so I can't use the usual:

Code:
$field_value = $_POST['field_name'];

Any ideas?


Appreciate your help.


  The best way of verifying an email
Posted by: El Forum - 04-19-2008, 06:00 AM - Replies (8)

[eluser]Leggy[/eluser]
Well i have been fiddling with an old function recently and as many of you know checkdnsrr() doesn't work on windows servers so i decided to create an email checking function which checks the servers OS and if it is windows it uses fsockopen on port 25 to check. Here is my current function:

Code:
&lt;?php
function check_email( $email, $rec_type = 'MX' )
{
    // Check if the domain is the correct format e.g. [email protected]
    if( !@preg_match( '/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix', $email ) ) return;
    else
    {
        // Check if they included a rec type to check the server
        if( $rec_type == ( '' or null or false ) ) return true;
        else
        {
            // Seperate the username and domain to for checking
            list( $username, $domain ) = @split( '@', $email );
            
            // Check if the server is a Windows server
            if( @stristr( PHP_OS, 'Win' ) and PHP_OS != 'Darwin' )
            {
                // Check the socket (25)
                if( @fsockopen( $domain, 25, $errno, $errstr, 30 ) ) return true;
                else return;
            }
            else
            {
                // Check the DNS record
                if( @checkdnsrr( $domain, $rec_type ) == true ) return true;
                else return;
            }
        }
    }
}
?&gt;

What would you recommend adding?

I was also considering modifying this so be able to use it in the verification class instead of its current email checker which only uses regex.


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Latest Threads
codeigniter4/queue Not lo...
by mywebmanavgat
4 hours ago
Array to HTML "Table"
by HarmW94
5 hours ago
shortcodes for ci4
by xsPurX
6 hours ago
TypeError when trying to ...
by b126
Today, 12:04 AM
Webhooks and WebSockets
by InsiteFX
Yesterday, 10:39 AM
Retaining search variable...
by pchriley
Yesterday, 05:46 AM
Reading a session variabl...
by xanabobana
Yesterday, 05:05 AM
Update to v4.5.1, same us...
by kenjis
04-17-2024, 07:47 PM
Codeigniter 4 extend core...
by Semsion
04-17-2024, 05:08 AM
v4.5.1 Bug Fix Released
by lokman
04-16-2024, 02:12 PM

Forum Statistics
» Members: 84,584
» Latest member: kalyt72
» Forum threads: 77,559
» Forum posts: 375,899

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB