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 6843141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:12:36+00:00 2026-05-27T00:12:36+00:00

Thanks in advance for the help that will be received! I used to use

  • 0

Thanks in advance for the help that will be received!

I used to use a code I made when I first started, due to not being able to find a snippet that does what I want. (Maybe to not knowing the terminology) I’m sure there’s a more simple way, which is why I’m asking advice.

/EDIT/
The pages that will use this template are temporarily hosted in a subdirectory of another website, and using “/” to start at the root of the page isn’t an option I want to go with, due to wanting to effortlessly drop the website on a different hosting server and add a domain name to the pages so the path from root (ex. “/temp-dir/site/images/image.jpg”) will need updated, whereas, using a previous directory (ex. “../../../images/image.jpg”) will work from existing site and new location upon move.
/endEDIT/

What I am trying to achieve is applying the proper amount of “../” before the file names in a header template using a method like:

<link href="<?php if(isset($pDepth)){ echo $prev; }?>style.css" />

Where $prev will equal previous directory code ranging from “../” to “../../../../” depending on the variable $pDepth on each web page. For example:

if($pDepth == 3){the output of $prev will equal "../../../"}

I seen where the output can change using ++, but you can’t add strings can you? I’m thinking something like:

if($pDepth == 4){

  $i = 0;

  while($i != $pDepth){

    // help needed here
    // add "../" until $prev = "../../../../"

  }
}

I’m still learning to write code, and would appreciate any help. Thanks Again!

  • 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-27T00:12:36+00:00Added an answer on May 27, 2026 at 12:12 am
    $prev = str_repeat('../', $pDepth); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi thanks in advance for your help. I'm just getting started learning Python and
First off, thanks in advance for your help. This issue is driving me nuts.
newbie here, so thanks in advance for help! I have a Wordpress site with
Thanks in advance for your help. I have a need within an application to
Thanks in advance for any help you can provide on this issue! I manage
Thanks in advance for your help experts. I want to be able to copy
I am using c# .net. Thanks in advance for any help. I have searched
I need help in jquery. Thanks in advance. I am using autocomplete function of
Thanks for any help in advance, I can't wrap my SQL skills around this
and thanks in advance for the help. Background - I am writing a PHP

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.