Welcome Guest, Not a member yet? Register   Sign In
  I test but got the same prob :(
Posted by: El Forum - 05-27-2008, 10:02 AM - No Replies

[eluser]bayrem[/eluser]
sorry made a new topic instead of reply post Sad

Please delete


  URL segment depth problems
Posted by: El Forum - 05-27-2008, 09:32 AM - Replies (15)

[eluser]floweringmind88[/eluser]
I have links:

<a href="index/variable">A</a> <a href="index/variable">B</a>

The first url works great:
http://www.domain.com/page/index/variable

but then the next link I click on is like:

http://www.domain.com/page/index/index/variable

I was wondering what other people do to keep the URL from going deeper.

Thanks


  Query Strings are a total turn off to CodeIgniter
Posted by: El Forum - 05-27-2008, 08:44 AM - Replies (6)

[eluser]floweringmind88[/eluser]
I have spent days trying to just send some variables to the page I am at. It would be really nice if there was a good tutorial on how you do this as this seems to be the method that you think is best.

For example I go to the page:
http://domain.com/page/

Now I want send a variable but I always get a 404 page not found:
http://domain.com/page/variable

This is how my code looks:

class Welcome extends Controller {

function Welcome()
{
parent::Controller();

}

function index()
{
$product_id = $this->uri->segment(2);

$this->load->view('header');
$this->load->view('welcome');
$this->load->view('footer');
}


  use ExtJS for views (prob to include and load it)
Posted by: El Forum - 05-27-2008, 08:43 AM - Replies (15)

[eluser]bayrem[/eluser]
Hi,

First of all I ant to thank you for this exellent and complete framework.

I decide to use CI in my new project as the framework for views extjs (A well knwon JS library).

I got prob including this one in one CI view Sad

I saw manuy posts and execionnaly this one who got prob like mine http://ellislab.com/forums/viewthread/73741/

the Prob :

I can't include ExtJS library.

Test :

Code:
&lt; script type="text/javascript" src="/extjs/ext-all.js"&gt;< / script>

and this

Code:
&lt; script type="text/javascript" src="&lt;?=basepath;?&gt;/extjs/ext-all.js"&gt;< / script>

No way

got the page but I think that library doesn't load Sad

I got this errors in FIREBUG
Code:
Ext is not defined
[Break on this error] Ext.onReady(function(){
layout.js (line 9)
Ext is not defined
[Break on this error] Ext.DomHelper=function(){var L=null;var F=/^(?:br|frame|hr|img|input|link|meta|r...
ext-all.js (line 9)
sp is undefined
[Break on this error] Ext={version:"2.0.2"};window["undefined"]=window["undefined"];Ext.apply=function...
ext-base.js (line 9)
Ext.onReady is not a function
[Break on this error] Ext.onReady(Ext.example.init, Ext.example);
examples.js (line 60)

Please Help I'm lost

Regards


  Getting single DB results
Posted by: El Forum - 05-27-2008, 08:39 AM - Replies (7)

[eluser]rvent[/eluser]
Hello,

I am having this little problem that i cant seem to find a solution to. I am executing a query to my DB to get a single record once i get it it is used by another function to get the list of records who belong to that value.

EX: I have a workOrder 12345 and workOrder 12345 has many messages all of which have an association to their respective workOrder.

Here is my model function:

Code:
function getWOid($woID)
    {
        $sqlGetWo = "SELECT WOrderID
                     FROM WorkOrder
                     WHERE WOrder = ?
                     LIMIT 1";
                    
        $sqlWoID = $this->db->query($sqlGetWo, array($woID));
        return $sqlWoID;
    }

And here is my test controller function:
Code:
function testDB()
    {
        $wId = $this->input->post('WorkOrder');
        $messageID = NULL;
        $woID = $this->SmtJob->getWOid($wId);
        $row = $woID->row();
        $myID = $row->WOrderID;
                                
        $messageData = array('WOMessage' => $this->input->post('Message'),
                             'WOMessageID' => $this->input->post('WOMessageID'),
                             'AuthorID' => $this->input->post('AuthorID'));
        
        $msgData = array('WOMessage' => $this->input->post('Message'),
                             'WOMessageID' => $messageID,
                             'AuthorID' => $this->input->post('Author'),
                             'WOrderID' => $myID);
                            
        echo "$wId <br>";
        echo $messageData['WOMessage'];
        echo $msgData['WOrderID'];
        
    }

ANd certainly this is a no go since i get error about object properties:
Code:
$woID = $this->SmtJob->getWOid($wId);
$row = $woID->row();
$myID = $row->WOrderID;

the docs say that using "query->" i would need to use the http://ellislab.com/codeigniter/user-gui...sults.html but i feel like using a whole block to get 1 result its a little too much..

Is there another way to get a single result other than:
Code:
$query = $this->db->query("YOUR QUERY");

foreach ($query->result() as $row)
{
   echo $row->title;
   echo $row->name;
   echo $row->body;
}

Thanks..


  Latavish's Multiple Image Upload with Thumbnail Generation
Posted by: El Forum - 05-27-2008, 07:41 AM - Replies (31)

[eluser]Latavish[/eluser]
Latavish's Multiple Image Upload w/ Thumbnail Generation

Hi CI lovers,
I hope you guys had a GREAT and EXTENDED weekend. Been working on this for a few days now and finally finished up this weekend and wanted to share my work with this great community. Now this code is really customizable so feel free to trick it out to fit your needs. Code may not be perfect because I designed this to fit my needs on a project that i'm doing. (a nice CMS) If you find this code useful all I require is a simple thanks! TeeHee!! :-) Happy Coding...

Features:
Upload Multiple Images at once
Automatically Renames Images to a random name (protects file from being overwritten)
Adds Image Information to DB

C O N T R O L L E R

Code:
class Upload extends Controller {

    function Upload()
    {
        parent::Controller();
        $this->load->helper(array('form','url','file'));
        
    
    }
    
    function index()
    {
        
        $this->load->view('upload/upload_index'); //Upload Form
        
    }

    function picupload()
    {
        //Load Model
        $this->load->model('Process_image');

        $config['upload_path'] = './uploads/';
        $config['allowed_types'] = 'gif|jpg|png';
        $config['max_size']    = '2048'; //2 meg


        $this->load->library('upload');

        foreach($_FILES as $key => $value)
        {
            if( ! empty($key['name']))
            {
                $this->upload->initialize($config);
        
                if ( ! $this->upload->do_upload($key))
                {
                    $errors[] = $this->upload->display_errors();
                    
                }    
                else
                {

                    $this->Process_image->process_pic();

                }
             }
        
        }
        
        
        $data['success'] = 'Thank You, Files Upladed!';

        $this->load->view('upload/upload_pictures', $data); //Picture Upload View

        
        
        
    }

M O D E L

Code:
class Process_image extends Model {
    
    function Process_image()
    {
        parent::Model();
        
        $this->load->library('image_lib');
        //Generate random Activation code
        
        function generate_code($length = 10){
    
                if ($length <= 0)
                {
                    return false;
                }
            
                $code = "";
                $chars = "abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789";
                srand((double)microtime() * 1000000);
                for ($i = 0; $i < $length; $i++)
                {
                    $code = $code . substr($chars, rand() % strlen($chars), 1);
                }
                return $code;
            
                }

    }

function process_pic()
    {  
        //Connect to database
        $this->load->database();
        
        //Get File Data Info
        $uploads = array($this->upload->data());
        
        $this->load->library('image_lib');

        //Move Files To User Folder
        foreach($uploads as $key[] => $value)
        {
            
                        //Gen Random code for new file name
            $randomcode = generate_code(12);
            
            $newimagename = $randomcode.$value['file_ext'];
            
            //Creat Thumbnail
            $config['image_library'] = 'GD2';
            $config['source_image'] = $value['full_path'];
            $config['create_thumb'] = TRUE;
            $config['thumb_marker'] = '_tn';
            $config['master_dim'] = 'width';
            $config['quality'] = 75;
            $config['maintain_ratio'] = TRUE;
            $config['width'] = 175;
            $config['height'] = 175;
            $config['new_image'] = '/pictures/'.$newimagename;

            //$this->image_lib->clear();
            $this->image_lib->initialize($config);
            //$this->load->library('image_lib', $config);
            $this->image_lib->resize();
            
            //Move Uploaded Files with NEW Random name
            rename($value['full_path'],'/pictures/'.$newimagename);
            
            //Make Some Variables for Database
            $imagename = $newimagename;
            $thumbnail = $randomcode.'_tn'.$value['file_ext'];
            $filesize = $value['file_size'];
            $width = $value['image_width'];
            $height = $value['image_height'];
            $timestamp = time();
            
            //Add Pic Info To Database
            $this->db->set('imagename', $imagename);
            $this->db->set('thumbnail', $thumbnail);
            $this->db->set('filesize', $filesize);
            $this->db->set('width', $width);
            $this->db->set('height', $height);
            $this->db->set('timestamp', $timestamp);
            
            //Insert Info Into Database
            $this->db->insert('pictures');

        }
        
        
        
    }


  server 500 with xampp
Posted by: El Forum - 05-27-2008, 07:35 AM - No Replies

[eluser]neilw[/eluser]
Hello,
Everything was fine until I moved to xampp, now all I get is errors when I use the .htaccess file, even just having 'rewriteengine on' by itself generates an error. I've checked the forums for similar but not seem to work. mode_rewrite is loaded.

In my original working (pre-xampp) version I simply had this:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|user_guide)
RewriteRule ^(.*)$ /index.php/$1 [L]

Now it produces a server 500.

I followed the wiki (http://codeigniter.com/wiki/mod_rewrite/) and with that, no matter what I type in the url or controller I use, it ignores it and goes to the welcome page. If I click on links from the welcome page, they just get appended too and stay in the welcome page, e.g.
http://localhost.ignite/welcome/game/use...ser_guide/

My original apache used virtual directories, but I also tried using alias, but both have the same results.

I've tried full access, e.g.
Code:
<Directory "c:/documents and settings/803300352/My Documents/DATA/Training/php/ignite_test">
        Options Indexes Includes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

and still the same.

Can anyone help?

Thanks.


  Dynamic Elements in the Layout Library
Posted by: El Forum - 05-27-2008, 07:22 AM - No Replies

[eluser]AgentPhoenix[/eluser]
I've officially taking the dive into a full-blown application using CodeIgniter. I've been chomping at the bit to actually get in there and do it now for several months, but time being what it is, I'm just now getting started. I started playing around with the Layout Library last week and it seems like a perfect solution for how I'd like to do templating. However, one issue came up as I've been brainstorming it. The application calls for the menus to be generated out of the database, so what would be the best way to do that given that the method used to displaying the actual page puts the data into a specific location farther down the page? Any help or suggestions would be awesome. Thanks!


  Page not loading properly, need to hit refresh to see current page.
Posted by: El Forum - 05-27-2008, 06:42 AM - Replies (2)

[eluser]skrobma[/eluser]
I believe this has to do with a common controller I created. Whenever it's called the page just loads with the same data. But when I hit the refresh button the page changes properly.

This happens with the menu items (categories) and login which are both in the common controller.

You need to login for the categories to populate. (if you have problems logging in just go back to the site defined and click refresh.
Site: http://www.mypodstudios.com/asco/
login: asco/asco123

The asco controller builds the page. Common performs login/logout/category change.


Below is the category code from the common controller.

Code:
function cat()
    {
        $redir = $this->session->userdata('pod_path'); //asco
        // UNSET Video so next refresh has image not video
                $this->session->unset_userdata('vid_id');
        $this->session->set_userdata('catid',$this->uri->segment(3));
        redirect($redir);    
    }

Thanks -Mark


  ModRewrite for Lighttpd?
Posted by: El Forum - 05-27-2008, 05:45 AM - Replies (5)

[eluser]Philip Pryce[/eluser]
Does anyone have a clue how to make ModRewrite work in Lighttpd, i've got the module installed, but i'm not sure how to layout the .htaccess file.
I'm also not the greatest with Regular Expressions, so if someone could translate the default Apache 2 one into a Lighttpd one that would be amazing.

Thanks, Phil


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

Username
  

Password
  





Latest Threads
TypeError when trying to ...
by b126
1 hour ago
Retaining search variable...
by pchriley
2 hours ago
Reading a session variabl...
by xanabobana
3 hours ago
Update to v4.5.1, same us...
by kenjis
Yesterday, 07:47 PM
Codeigniter 4 extend core...
by Semsion
Yesterday, 05:08 AM
v4.5.1 Bug Fix Released
by lokman
04-16-2024, 02:12 PM
problem with textarea
by Nitin Arora
04-16-2024, 05:07 AM
Showing pdf on browser
by aarefi
04-16-2024, 04:38 AM
[4.5.1] Disabling the deb...
by keto
04-16-2024, 02:43 AM
directory structure
by badger
04-16-2024, 01:49 AM

Forum Statistics
» Members: 84,447
» Latest member: 8xbet66bet
» Forum threads: 77,557
» Forum posts: 375,889

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB