Welcome Guest, Not a member yet? Register   Sign In
  .htaccess and URI routing to redirect everything to a single controller/function...
Posted by: El Forum - 08-18-2007, 01:16 PM - No Replies

[eluser]snaggy[/eluser]
I wrote a tiny little mini cms for myself which only consists in a controller where the only function that should be accessed is index

current URI:

http://localhost/CI/index.php/MyControll...x/&#xpa;ge level 1%/&#xpa;ge level 2%

this part is useless

index.php/MyController/index/

How can I remove it? I tried to remove at least index.php (user guide) but it doesn't work
if I write

http://localhost/CI/MyController/index/&#xpa;ge level 1%/&#xpa;ge level 2%

it gives me this error:

No input file specified.


Any help appreciated, as this seems pretty hard for me..


  Multiupload Demo - possible with CI?
Posted by: El Forum - 08-18-2007, 01:14 PM - No Replies

[eluser]stevefink[/eluser]
I love this: http://swfupload.praxion.co.za/multiuplo.../index.php

Does anyone have experience integrating something similar in CI?

I'd be most honored for any assistance/help in getting something similar into my application.

Thanks all.

- sf


  Active Record Delete
Posted by: El Forum - 08-18-2007, 11:16 AM - No Replies

[eluser]Kemik[/eluser]
Hello,

Is it possible to add an "OR" to the active record delete? I want to delete a record where the permission_id = 7 or 8.

$this->db->where('id', $id);
$this->db->delete('mytable');

If not, I'll just use the regular $query = "INSERT QUERY HERE";
$query = $this->db->query($query);

Thanks.


  What would be the best way to go about making a CMS?
Posted by: El Forum - 08-18-2007, 12:00 AM - No Replies

[eluser]chobo[/eluser]
I'm not sure how to go about making a CMS for my site... Should I just make a new controller and create a CMS library. It just seems wrong to have all the files for the site mixed together with it... If I use a controller would it be easy to block access to it via .htaccess file? Any help is appreciated, thanks.


  File uploads and ajax insight
Posted by: El Forum - 08-17-2007, 09:22 PM - No Replies

[eluser]stevefink[/eluser]
Hi all,

I'm kind of at a writer's block. I'm looking for some unobtrusive yet elegant ways of handling an upload form for a user. The user wants to be able to upload a directory filled with images if possible, or one at a time. I'll store image names/paths in a table. I was wondering if anyone would be kind enough to show me some examples of file uploads with progress bars and ajax in a code igniter application?

Any hints/ideas would be appreciated. :-)

Thanks all and have a great weekend!

- sf


  Join Command Works in phpMyAdmin, but Hangs When Run via PHP?
Posted by: El Forum - 08-17-2007, 06:49 PM - No Replies

[eluser]Vik[/eluser]
I have a join command that was perfectly generated by CI:

Code:
select * from metal_desc join abbrev on metal_des.ndb_no = abbrev.ndb_no where long_desc like 'copper' order by long_desc

I ran it in the phpMyAdmin Query window, and it ran perfectly, and came back with the correct results.

But when I run it in CI, when it comes time to execute it in the _execute function in mysql_driver.php:

Code:
function _execute($sql)
    {
        $sql = $this->_prep_query($sql);
        return @mysql_query($sql, $this->conn_id);
    }
...it seems to halt PHP execution. The next line of code never runs. It's like PHP or MySQL is hanging.

Checking the server error logs for PHP, MySQL, and Apache, shows no errors.

When I run a Query in CI without the join command, like this:

Code:
select * from metal_desc where long_desc like 'copper' order by long_desc

...everything runs perfectly.

Does anyone have any notion what could be causing this?

Thanks in advance to all for any thoughts.



[Note - something's garbling the % signs in the mySQL code. It should say percent-sign "copper" percent-sign.]


  Using the language strings in the view
Posted by: El Forum - 08-17-2007, 06:37 PM - No Replies

[eluser]Unknown[/eluser]
This might be a stupid question but I found no answer to it.

In the controller I use:
$this->lang->line('language_key');

but I have no use fo the language strings in the controller, i need them in the view.

But what do I use in the view?! Do I have to pass all the language keys in an array to the view or is there something more automatic?


  Default values with set_select()
Posted by: El Forum - 08-17-2007, 06:37 PM - No Replies

[eluser]BravoAlpha[/eluser]
I've been looking, unsuccessfully, for a way to provide a default value for a select element that I am building myself:

Code:
<select name="category_id">
&lt;?php foreach($categories->result() as $category): ?&gt;
    <option value="&lt;?php echo $category->category_id; ?&gt;"&lt;?php echo $this->validation->set_select('category_id', (string)$category->category_id); ?&gt;>&lt;?php echo $category->title; ?&gt;</option>
&lt;?php endforeach; ?&gt;
</select>

I came up with this replacement function:
Code:
function set_select($field = '', $value = '')
{
    if ($field == '' OR $value == '')
    {
        return '';
    }
    
    if (isset($_POST[$field]) AND $_POST[$field] == $value)
    {
        return ' selected="selected"';
    }
    else if (isset($this->$field) AND $this->$field == $value)
    {
        return ' selected="selected"';
    }
}
Any thoughts?


  How to structure my site
Posted by: El Forum - 08-17-2007, 04:13 PM - No Replies

[eluser]Hamilogre[/eluser]
I'm new to CI, I think I have read the entire user guide, and wiki, and I have also read a lot on the forums. I have a question about how to structure my application.

The site is for a doctor's office where there are 7 doctors in the practice. I want to build a backend for the practice administrator to be able to edit things herself so it doesn't require code changes when things need to be updated. What I'm working on now, is the doctor's main page that lists all the doctors, and the individual doctor's pages that shows their bio.

For the doctor's page, I want my URL to be http://www.mysite.com/doctors. (Fine, all I do is tell the index function to load the doctors/index view, as shown below:

Code:
function index()
{
    $this->load->view('doctors/index');
}

Now for each individual doctor, I want the URL to be: http://www.mysite.com/doctors/doctorlastname and I'm not sure how to setup my functions in the doctors controller to do this, so that my site is truly dynamic. If I setup a function for each doctor's last name, that would defeat the purpose of making it dynamic, as I want to only store each doctor's name 1 time in my database.

What I have come up with is to have a function called bio in my doctors controller to load the view of the appropriate doctor. Then I configured my routes to do this:
Code:
$route['doctors/:any'] = "doctors/bio"

And here is my bio function:
Code:
function bio()
{
    $this->load->view('doctors/' . $this->uri->segment(2));
}

I think this function may need some reworking too, it seems to simple to me, any suggestions?

That works fine, but now what if I want to make a url to edit the bio something like this: http://www.mysite.com/doctors/doctorlastname/edit. How do I set it up so that that url doesn't get routed to doctors/bio.

One question about views too. Say the above code segment loads the view doctors/smith. In my doctors/smith view, it it appropriate for me to call my header and footer view from within the doctors/smith view? Not sure what the best way to set this up is. I noticed that you can only call one view from a controller.

Here is what my doctors/smith view would look like:
Code:
&lt;?php $this->load->view('global/header'); ?&gt;
<p> Dr. Smith Bio</p>
&lt;?php $this->load->view('global/footer'); ?&gt;

Is this the proper way to include my header and folder?

I think I am close to fully understanding how this works, but I need some assistance getting a grasp on it. Any help would be appreciated.

Thanks.


  Strange db_session problem
Posted by: El Forum - 08-17-2007, 03:33 PM - No Replies

[eluser]Référencement Google[/eluser]
Hi,

I've got a strange db_session library problem (library taken in FreakAuth, but probably doesn't matter)

I try to store in a session the actual uri, so I made like that:

Code:
$this->db_session->set_flashdata('redirect_uri', $this->uri->uri_string());

In the DB table ci_sessions, field session_data, I get this result:

Code:
a:10:{s:2:"id";s:1:"7";s:9:"user_name";s:10:"elitemedia";s:10:"country_id";N;s:5:"email";s:24:"[email protected]";s:4:"role";s:4:"user";s:10:"last_visit";s:19:"2007-08-17 23:16:17";s:7:"created";s:19:"2007-08-17 23:16:17";s:8:"modified";s:19:"0000-00-00 00:00:00";s:22:"flash:old:redirect_uri";s:39:"/espace_vipx/view_profile/favicon.ico";s:22:"flash:new:redirect_uri";s:39:"/espace_vipx/view_profile/favicon.ico";}

What is very strange, is why he put at the end of my uri "favicon.ico", this is not in the uri wich originally look like that:

Code:
http://localhost/dev/espace_vipx/view_profile/1

If I try to echo $this->uri->uri_string(), I get the right uri string, this problem comes only when i include the uri in the DB. Maybe this is the numeric number ID at the end ?

I turned crazy with this, can somebody help ?


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

Username
  

Password
  





Latest Threads
Validation Rules: Valid e...
by sevmusic
32 minutes ago
Changing Session cookie -...
by codeus
3 hours ago
which linter to use (and ...
by paulbalandan
4 hours ago
Update from 4.6.0 to 4.6....
by Vespa
Yesterday, 01:17 AM
hot-reload side effects s...
by InsiteFX
05-17-2025, 10:11 PM
using app/Config/App.php ...
by sam547
05-16-2025, 03:04 PM
Setting baseURL in Regist...
by grimpirate
05-15-2025, 02:20 PM
CRUD Code Generator
by DeanE10
05-15-2025, 05:31 AM
CI debugging tools
by Montasser
05-14-2025, 02:54 PM
CodeIgniter.com - Report ...
by Harry Lyre
05-14-2025, 04:26 AM

Forum Statistics
» Members: 146,900
» Latest member: d55wiki
» Forum threads: 78,393
» Forum posts: 379,480

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB