Welcome Guest, Not a member yet? Register   Sign In
  How to dynamically link to a dynamic single db record view?
Posted by: El Forum - 12-14-2008, 11:29 AM - Replies (3)

[eluser]Unknown[/eluser]
Looked for this, but new to CI so not sure what to look for.

I have a controller which loads a view. The view shows a query listing of records.

How do I write a dynamic link for each record result in the list which then opens a single record view?

What is best practice in MVC?


  Libraries in subdirectories?
Posted by: El Forum - 12-14-2008, 10:35 AM - Replies (2)

[eluser]Unknown[/eluser]
Is it possible to put libraries in subdirectories under my system/application/libraries folder? For example:

file: libraries/wsactions/Getdetail.php
code: $this->load->library('wsaction/getdetail');

my class:
--------------------
class Getdetail {
function Getdetail(){
}
}
--------------------

I try this and it just gives me an error:

--------------------
Fatal error: Class 'wsactions/getdetail' not found in <b>/www/htdocs/conf/system/libraries/Loader.php</b> on line 873
--------------------

Anyone have suggestions? Has anyone done this before?


  [SOLVED] Problems with .htaccess not removing index.php in URL.
Posted by: El Forum - 12-14-2008, 06:00 AM - Replies (4)

[eluser]Moult[/eluser]
I've searched around the forums for quite a bit and it seems as though a lot of people have encountered similar if not the same problem as I have. However, none of the fixes proposed has worked for me, hence I'm going to try and start my own thread to help solve it.

Basically, I run CI on my localhost and also on a shared webserver. It works perfectly fine on my localhost, however, on my shared webserver, there are some problems when I try to use the .htaccess file to remove the index.php from the url. Let's say I have just installed CI, I go edit system/application/config/config.php and change the base_url to http://mysite.com/ then I create a new controller with the file name other_page.php. Alright, going to mysite.com loads the welcome controller, as usual, then when I do mysite.com/index.php/other_page, it loads the other_page controller. Works fine. If I load mysite.com/other_page, I get a 404. This is working fine and as expected.

Now, I add a .htaccess file in the root dir (same dir as my index.php) with the lines:

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

Now, I edit my config.php again to change the index_page from "index.php" to "". (Yes, nothing), as asked by the comments in the file.
Ok. Visiting mysite.com still loads the welcome controller, that's good. Visiting mysite.com/other_page DOES NOT load the other_page controller like it should, but still loads the welcome controller. Visiting mysite.com/index.php/other_page loads fine, but it still has the index.php in the URL. What am I doing wrong?


  Help: Want custom URI controller handling
Posted by: El Forum - 12-13-2008, 11:13 PM - Replies (3)

[eluser]Unknown[/eluser]
I am new to CI and have some simple questions....

I have read that URL's such as http://localhost/blog/1/2/3 etc get sent automatically to a blog controller (blog.php) with parameters 1/2/3.

I don't want this feature... I simply want every request to go to a "default" controller with the parameters, how can I achieve this?

Now, given the above, I want to forward from this "default" controller to other controllers based on other logic. How can I forward from the "default" controller to other controllers?

thanks,
John.


  Add admin paths to your routes config
Posted by: El Forum - 12-13-2008, 09:31 PM - No Replies

[eluser]oddman[/eluser]
After having played around with a few different MVC frameworks, there are a few things that I'm bringing back to codeigniter (reason why I'm here is because CI is arguably the fastest MVC framework currently available in the languages I work with). So, here I present to you a solution for admin paths (which get built into your usual controllers). Let's say for example you have a products URL: /products/some-product-name/. There's a lot of functionality in there that we may not necessarily want to re-write, especially within that controller. So what we want to do is alter the routes so that we can use that controller for admin as well:

Code:
$route['admin/?'] = 'home/admin_index';
$route['admin/([a-z]+)/?'] = '$1/admin_index';
$route['admin/([a-z]+)/([a-z]+)'] = '$1/admin_$2';

What we're doing, is taking all requests that start with 'admin' and converting them to use specific actions (convention over configuration). So as an example, if I were to go to:

/admin/products/

This would, in fact - point the request to the Products controller, and call the admin_index method.

Why do we want to do this? We're sharing code for the products controller with the admin, and simply placing administration restrictions on code we've already written. By calling admin views, we then also customize the way it is displayed.

Hope this helps others Smile


  Doesn't active record sanitize input anymore?
Posted by: El Forum - 12-13-2008, 05:52 PM - Replies (9)

[eluser]FinalFrag[/eluser]
I have a textfield on a form.
When I click submit, I retrieve the information in my controller using

Code:
$this->input->post('textfield');

Then I use a model (with active record) to store the input in a database.

My problem is: when I enter
Code:
<b>hello</b><i>world</i>

in the textfield... it doesn't get escaped...

Did they remove the auto-escape feature from CI in 1.7 or am I doing something else wrong?

Thnx


  NULL check problem/question
Posted by: El Forum - 12-13-2008, 05:19 PM - Replies (1)

[eluser]Unknown[/eluser]
Hi,

I have a question, I'm probably missing something obvious, but wanted to ask for help:

I have this line of code in my controller:

Code:
$data['category'] = null;

I am passing this into my view like follows:

Code:
$this->load->view('catalogue_view', $data);

In my view file (catalogue_view.php), I have the following line:

Code:
&lt;?php if (is_null($category)): ?&gt;

My problem is, my if statement is evaluating to false, even though I know it has been set to false.

What am I missing here?

Thanks,
C.


  We need official AJAX library from CI team !
Posted by: El Forum - 12-13-2008, 05:04 PM - Replies (43)

[eluser]Mossab Alzeeny[/eluser]
Hello everyone,

Please... let me tell you my little Sad story :-S

I'm working on my first project using CI,

first i had to make a WHOLE Users system, but Thx to DX Auth
did the job and even gave me more functions that i wouldn't have dreamed of ^^

Then.... i needed to use ajax. Sad
first, i searched all over the wiki, and found few libs. but i picked (AJAX for CodeIgniter)

i didn't like the way it works actually ( to make a link, u'll have to use a function, to use a button u have to use Another function , and so on )

and also there's no need to use a WHOLE js framework just to call files through Ajax ... dont u think?

i know this library does more than just ajax files calling, this is the point. we need Ajax library, not a JS library

on top of all of this, the prototype lib, conflicted with the jquery lib (i used it for another purpose),

and when i solved the problem, guess what ? there was a problem with the prototype lib. it self,
so i said, (*beep* it) .. i worked on this thing for almost 7 hours and...
progress : 0, ZERO, NONE

then a brilliant idea came to my mind, why dont i use just the normal way to ajax things (add JS code to haeder, use ajax() function , code attached)!!! guess what again ? it WORKED Confusednake:


after a real hard day, i came up with few tips :
1- never give up with a code, because there's always a solution ( doesn't mean that u can forget your Deadlines
2- always save your own old codes, could help u someday
3- help ppl by showing the problems you had, maybe someone will help you, or maybe you'll help someone by showing him that, THERE'S NO SOLUTION FOR THIS ONE,!! lol


and the Most important thing,
We need an Official AJAX library from Codeigniter Team,

no that i think that no one can make a good lib. but only that im Pretty sure, many many people will get through all of this problems over and over, until we get the official library


so what do u think ?


* P.S: i know that many of you guys thinking ( lazzy ass, go make your own library, stop crying about it )
Well, THANK YOU :-P But you cant say we dont need it ,


Kind Regards.
Mossab


  Web Services?
Posted by: El Forum - 12-13-2008, 12:14 PM - Replies (7)

[eluser]Iverson[/eluser]
Anybody familiar with how these work? I've read tutorials but I'm still not quite grasping it. I'm trying to figure out how sites like Kayak pull their data. Obviously I'm trying to figure out if this could this be done using PHP b.k.a. CI. Any direction would be greatly appreciated!


  Where to put certain code
Posted by: El Forum - 12-13-2008, 11:05 AM - Replies (14)

[eluser]jaswinder_rana[/eluser]
Hi:

I have just downloaded CodeIgniter. I am not sure about where to place certain code.

I have started my own application. My first part is to build authentication system. I have the tables and logic planned out. I have already done many authentication system but I wanted to do it with CodeIgniter this time.

I have few questions:

- Where do I place code for login
- Where do I place code for checking login for users


Some different topics are:
- If I have a header view, do I need to include it in every Controller? Or is there a way to automatically include it in every controller?
- If I have sidebars, and some content might be page specific and some application wide. What is the best way to deal with them? Call Models in every controller?


As you can see, it's overwhelmed me a little.

I know (and am reading) CodeIgniter manual. But, are there some sample applications, say a sample blog system or something, that I can look at and see how they do things?

Oh and totally off topic question, is there plan to write PHP5 only CodeIgniter?

Please help.

Thanks


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

Username
  

Password
  





Latest Threads
Codeigniter Shield Bannin...
by kenjis
4 hours ago
SQL server connection not...
by kenjis
4 hours ago
Best way to create micros...
by kenjis
6 hours ago
How to use Codeigniter wi...
by kenjis
6 hours ago
Getting supportedLocales ...
by kcs
Today, 09:30 AM
Component help
by FlashMaster
Today, 01:41 AM
Show logo in email inbox
by WiParson
Today, 12:48 AM
CI 4.5.1 CSRF - The actio...
by jackvaughn03
Yesterday, 10:17 PM
Limiting Stack Trace Erro...
by byrallier
Yesterday, 02:21 PM
Bug with sessions CI 4.5....
by ALTITUDE_DEV
Yesterday, 01:36 PM

Forum Statistics
» Members: 85,253
» Latest member: f88betcc
» Forum threads: 77,577
» Forum posts: 375,977

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB