Hi nice people hope u are all well :>)
Guys hopefully an easy one.
------------
Scenario
------------
Page 1:
menu5_it_scripting_perl_va
riables_im
ageskb.php
<?php include ("includes/specific_includ
es/images_
pages/prev
iewarea_an
d_carousel
.php"); ?>
Page 2:
includes/specific_includes
/images_pa
ges/previe
warea_and_
carousel.p
hp
<?php
$current_loaded_page = basename(__FILE__);
$get_correct_folder = explode('_',$current_loade
d_page);
$lose_first_element = array_shift($get_correct_f
older);
$get_correct_folder = implode('/',$get_correct_f
older);
$get_correct_folder = substr($get_correct_folder
, 0, -4);
echo "The value of \$get_correct_folder is: " . $get_correct_folder . "\n";
?>
---------------------
Problem i have:
---------------------
When i load up page1 (eg.menu5_it_scripting_per
l_variable
s_imageskb
.php), and see the value of:
echo "The value of \$get_correct_folder is: " . $get_correct_folder . "\n";
it returns the value for being run against page 2, when what I want is all that code ive pasted above to actually run against page 1.
I know I can just "include" directly into the page1 page (menu5_it_scripting_perl_v
ariables_i
mageskb.ph
p) this code, but that means i will have to do this for a lot of pages.
--------------
Question:
--------------
Is there any way to "include" a reference to a file with the code i have above into page1 (without having to directly place the code in this file), and have that file execute against page1?
Is this where I have to turn the above code into a function, and then call it from within page1?
Any help greatly appreciated.
Start Free Trial