0
votes

I am trying to get the value of base_path variable in PHP (on lamp server) .

I have kept the code insider beta_test directory inside www directly.

i.e, base path function should return " /beta_test/ " . But it is returning just single slash ( "/" ) .

The code that I tried is

<script type="text/javascript" src="<?php print base_path(); ?>sites/all/themes/people10/slider/call.js"></script> 

Expected output is

<script type="text/javascript" src="/beta_test/sites/all/themes/people10/slider/call.js"></script> 

But its giving

<script type="text/javascript" src="/sites/all/themes/people10/slider/call.js"></script> 

I am using php version 5.3.3.Can anyone please help me in getting this issue solved? I am newbie to php and drupal .

1
The Expected output is ??? You are tried running sites/all/themes/people10/slider/call.js .. am a bit lost - Baba
You might need to escape your code by prepending four spaces to each line so it displays correctly. - Benjamin Brizzi
Your code is perfectly fine. If still it is not working then use echo and give a try. - Vins
I think you call the base_path function from outside of drupal, when yo say in PHP on a LAMP server - yunzen

1 Answers

1
votes

print $base_path returns the folder name where Drupal is installed.

The complete base URL is print $base_url.