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

  • SEARCH
  • Home
  • 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 8247125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:44:18+00:00 2026-06-07T22:44:18+00:00

I am working on a product catalog. The directory structure is 3 levels deep

  • 0

I am working on a product catalog. The directory structure is 3 levels deep from the domain root.

So say for instance I have a product page for an orange. And the orange is in a sub category called citrus, which is in a category called fruit which is in a directory called products. so the real path to this page would be http://www.mydomain.com/products/fruit/citrus/orange.php

Now, how would I get only the following: /fruit/citrus/orange when running orange.php

I have tried : dirname(__FILE__); but this gives an output of http://www.mydomain.com/products/fruit/citrus/orange which includes the domain which I do not want.

Could anyone offer any suggestions or advice on how I could accomplish something like this?

Thank you!

  • 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-06-07T22:44:19+00:00Added an answer on June 7, 2026 at 10:44 pm
    $levels = 3;
    $temp = array();
    
    $parts = explode('/', $_SERVER['REQUEST_URI']);
    for ($i = 0; $i < $levels; $i++) {
      $temp[] = pathinfo(array_pop($parts), PATHINFO_FILENAME);
    }
    $temp[] = '';
    
    $result = implode('/', array_reverse($temp));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a product catalog page, and the group of images needs to
I am working on one product which requires extensive testing of emails. I have
I am working on a product data importing system which downloads product data from
The product I have been working on has been in development for the past
I'm working on an extension that will receive product information from Magento when saved
I am working in a new Filter by Product module in Magento, i have
How to check body element (<body></body>) in prototype? This is not working: if( $('body').hasClassName(catalog-product-view)
When I try to overwrite a model from Mage_Catalog (Mage_Catalog_Model_Product_Image for instance) I have
I'm working on adding globalization to my product cataloge and I have made it
still working on Magento here. Currently I'm looking at the product page's view block,

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.