Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6621559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:16:53+00:00 2026-05-25T21:16:53+00:00

hi i am using codeigniter in my application . for my application i need

  • 0

hi i am using codeigniter in my application .

for my application i need application path only before the last slash

like this

if application path is

http://localhost/elephanti/connections/fb_connection/invite_friends

i want to get

http://localhost/elephanti/connections/fb_connection

it is for a plae like this

echo "<script type='text/javascript'>top.location.href = '"+APPPATH+"'testapp';</script>";

i tried to use '"+APPPATH+"'../testapp' but could not , please help ……………….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:16:53+00:00Added an answer on May 25, 2026 at 9:16 pm

    If you know the last part will always be the 4th, you can use a “dirty way” like this:

    $url = site_url($this->uri->segment(1).'/'.$this->uri->segment(2).'/'.$this->uri->segment(3));
    

    And then:

    echo "<script type='text/javascript'>top.location.href = '".$url."'/testapp';</script>";
    // here, though, I don't understan how "testapp" goes into the url..as a segment?
    

    This will create a valid CI url using only the first 3 segments.

    Alternatively, you can use the uri_string() function, wich returns only the segment part of the url. On this, you can explode/str_replace/array_pop/do whatever you need to and pass the new elaborated string on the site_url() function wichi will build the correct URL for you.

    I don’t understand what “testapp” is there or, do you want to substitute the last segment of your url with that? So that you have, in your example, http://localhost/elephanti/connections/fb_connection/testapp ?

    Keep in mind that both uri_string() and site_url() are functions from the URL helper so you need to load it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This article explains how to use Zend in Codeigniter. http://www.beyondcoding.com/2008/02/21/using-zend-framework-with-codeigniter/ I am using XAMPP
In my LAMP application (using CodeIgniter), I have a call to $this->db->update... that generates
Im building my first application using CodeIgniter, i need a bit of advice. There
I am reading a Codeigniter book, it said like this, When using the keywords
I'm developing web application using CodeIgniter. All this time, I put the custom js
I am using Codeigniter to develop an application, and have been reading bits about
I'm using CodeIgniter (because it's awesome) and I have something like: <?php echo anchor(/,
I am using codeigniter php MVC framework to develop a web application. I have
I'm looking for an introduction in creating application using CodeIgniter and Integrating it to
I'm building a self-hosted web app using CodeIgniter and I need a nice GUI-ified

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.