Code Igniter - Get Last URI Segment

Sep 30, 2010

I'm tying to get the last URI segment in CI, however I don't know what the number for it will be, as parameters (an integer) will be appended as the user clicks links within the page. These are then used in a controller to pull relevant database records into the page via ajax.

How can I tell CI to get the last segment?

Something like:

$record_num = $this->uri->segment($last);

View 2 Replies


Strip Tags That's Are NOT In [code] [/code] Segment?

I'm trying to find a way to strip tags from a user-inputted string except from tags that are wrapped in the [code] [/code] BB style tag.

For example, a user may enter this:


What I would like is the "hacked" alert to be removed, but not the "Hello" alert.

I would like to remove ALL tags (php, html, css, js) outside of the [code] but allow anything within them.

So far, I've got the following code to do the reverse of what I would like:


View 4 Replies

Javascript - Beginner - Pass Variable From One Code Segment To Another ?

I have index.php which uploads a file to server and sets several PHP variables (like $target_folder_and_file_name).

index.php also has the following line (it was originally index.html):

<script language="JavaScript" src="main.js.php"></script>

After index.php returned to the browser, the browsers asks for main.js.php from the server (right?).

Can I access somehow $target_folder_and_file_name from the PHP code in main.js.php ?

View 3 Replies

Execute Code Segment Only If Loop Reaches Its Last Cycle

Where is the most efficient position for a code block, which shall only execute, if a loop has reached its end, without having previously been aborted (via break or return)? Provided: "Some Code X" is always the same, only at different Code Segment Positions 1 and 2. I assume: 2 will be executed with the same reliability as 1. Am I wrong I know: 2 is obviously more efficient, as it is only called once after the loop ran $limit times, compared to 1, whose enclosing if-condition is called $limit times, and if once true, the code itself is called. Thus the efficiency difference is if-condition queried $limit times. Hence I conclude: To prefer using Code Segment 2 rather than Code Segment 1, unless my assumption is wrong!


View 3 Replies

Code Igniter Form_input?

A couple questions here..What is the following syntax? What do all the pieces mean?

(( ! is_array($data)) ? $data : '')

How is it used in the function at the end?

function form_input($data = '', $value = '', $extra = '')
$defaults = array('type' => 'text', 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
return "<input "._parse_form_attributes($data, $defaults).$extra." />";

View 4 Replies

Implement RSS 2 In Code Igniter?

How can I implement RSS 2 in Code Igniter?

View 1 Replies

Using Lightbox With Code Igniter?

I'm trying to use Lightbox with my CodeIgniter application. Lightbox says to put the following in the head tag:

<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />


This displays the thumbnail version, and then when clicked I want it to go to the lightbox, but now it goes to a new tab with the large image.

I've used lightbox before and have always gotten it to work, I'm not really sure what the problem is now, and I tried moving the files all around to different spots but nothing worked.

View 1 Replies

Code Igniter :: Use Get Values In CI?

In my projects i often use get params as a temporary way to test things with different values.However it seems like you cannot access get params in code igniter?I am aware I could build a param into my functions and pass the value as a url segment.But i dont want to be doing that every time I wish to test something.So,is there any way to use get values in CI?

View 2 Replies

Obfuscator For Use With Code Igniter Code?

I am looking for an obfucator for my PHP code, the code which I am trying to obfucate uses the codeigniter framework. The obfuscators that I have tried, don't seem to be able to do it.

View 4 Replies

Serving Different Views In Code Igniter

Is there best practice for serving different view for different context.For example, I'd like to serve specific pages for mobile user agents with the same controllers.

View 1 Replies

Deploying Code Igniter 1.7.2 Application On IIS 7?

I developed a Codeigniter 1.7.2 on wamp and it's almost completed. Now i am trying to host it on IIS 7 (yes IIS! because the control panel that is offered to me only has IIS in it) i am getting errors. This is what i get


View 1 Replies

Use A Code Igniter Class In Wordpress?

The class I wish to use is: url. How can I use this in a Wordpress project? Do I just take out the code igniter specific snippets out?

View 2 Replies

Code Igniter Function Call 404?

I was going through the official Code Igniter tutorial when I hit a snag...The tutorial had me save and run this code:

class Blog extends Controller {
function index()


View 5 Replies

Tell Code Igniter To Ignore / Lib / Css Path?

How can I tell CodeIgniter to ignore the /lib/css folder and load my stylesheets instead of trying to load things via my controller?

View 2 Replies

CakePHP To Code Igniter Conversion?

I want to convert an application from CakePHP to Code Igniter. Has anyone tried to do this? With my CakePHP application almost all the coding has been done in the controller layer, with the models pretty much exactly as they come out of baking.

View 1 Replies

Code Igniter Captcha Not Working?

code igniter captcha is not working in my page.My php gd library enabled but no change result.

View 3 Replies

Setting Up Emails In Code Igniter 2.02

I'm getting a lot of errors. And I've tried several suggestion across different sites, deleted the parent function, removed the array, updated my php ini file, no luck. This is the first of 13 errors I'm getting. A PHP Error was encountered Severity: Warning Message: fsockopen() [function.fsockopen]: unable to connect to [URL] (Unable to find the socket transport sslā did you forget to enable it when you configured PHP?) Filename: libraries/Email.php Line Number: 1673

class Email extends CI_Controller
function index()
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://';
$config['smtp_port'] = 465;
$config['smtp_user'] = '';

View 1 Replies

Jumping Controllers In Code Igniter

I am wanting to have a form of dynamic routing.

Basically I want to catch the 404 (done through routes.php 404_override).

This is easy enough.

But then what I want to do is run through a series of checks.

e.g pay no attention to the fact the is_xxx functions are not coming from anywhere

$what = $this->uri->segment(1);
//now I want to route this to the profile controller and call the display function like so
//display('vanity', $what);


How would I go about re-routing to the other controllers once the decision has been made?

View 1 Replies

Insert AT&T It Will Add Semicolon In Code Igniter?

Whenever I was inserting AT&T to database it was added as AT&T; semicolon is added extra in code igniter.My code is like this:


View 2 Replies

Logout Feature In Code Igniter?

I started using codeigniter for my project. I have user authentication system for my website. I have seen the videos from nettuts for the login information. I am confused why the logout is not working properly. I have the following logout function in my login controller.

function logout() {

If I click on the logout button I am redirecting the user to the main page. But after redirecting the user to the main page, if click on the back button on the browser I will see the logoff and my name on the top of the page. I need some help on where I am going wrong or is there any important piece of code I am missing in my controller I think I found the solution. I should append the following code into the appropriate controller

$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate, no-transform, max-age=0, post-check=0, pre-check=0");
$this->output->set_header("Pragma: no-cache");

View 1 Replies

Make A Breadcrumb With Code Igniter ?

best way to make a breadcrumb with Code Igniter.1 : Retrieve the strings with URLexample : this->uri->segment(2) 2 : Do you know another way ?I'd really like to have your opinion

View 1 Replies

Set_value() Default In Code Igniter?

I've used formigniter to generate a form forThat bit works great. However I want to set a default value for the name field.The input code looks like this:

<label for="forename">Forename</label>
<?php echo form_error('forename'); ?>
<br /><input id="forename" type="text" name="forename" maxlength="255" value="<?php echo set_value('forename'); ?>" />

View 1 Replies

Code Igniter Controller/Model Name Conflicts?

I have a controller and model both named "account" without getting "cannot redeclare class". I'd like to add a prefix to Models or Controllers, or preferably both.

View 2 Replies

Code Igniter - Use Only Shopping Cart Class?

A client of mine has a big php website, and wants to add shopping cart functionality. Is it possible to use Code Igniter's shopping cart class, without writing the whole site in the Code Igniter framework? How?

View 3 Replies

Routes - Moving First Steps With Code Igniter

I just moving my first steps with Code Igniter

I have a application/controller/login.php file containing the following


My routes definition looks like the following:

$route['default_controller'] = "welcome";
$route['login'] = 'login';
$route['scaffolding_trigger'] = "";

The problem is that i keep getting a 404 when i try to access [URL]. What did i do wrong? I've checked CI routes docs and cannot spot anything.

View 2 Replies

Code Igniter With Flex Is It Good Combination?

im looking forward flex php developers about their works with CI and flex combination.did you guys feels good and keep things innovativeand im just looking for working samples you have or you came across

View 2 Replies

Copyrights 2005-15, All rights reserved