unable to find correct path of file in subfolder

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
Nick225
Registered User
Posts: 103
Joined: Sat Nov 24, 2018 7:48 pm

unable to find correct path of file in subfolder

Post by Nick225 » Thu Feb 21, 2019 2:40 am

From my template, I am trying to read a file located in a subfolder.
root is http://xxxxx.com/phpbb3
file is located in http://xxxxx.com/phpbb3/funstuff
file name is hometowndata.json

...
sorry.. Please delete.
As soon as I posted this.. I found what i was doing wrong.
Thanks
Last edited by Nick225 on Thu Feb 21, 2019 2:49 am, edited 1 time in total.

User avatar
kinerity
Community Team Member
Community Team Member
Posts: 2204
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Truscott
Contact:

Re: unable to find correct path of file in subfolder

Post by kinerity » Thu Feb 21, 2019 2:48 am

This should work:

Code: Select all

if (file_exists($phpbb_root_path.'funstuff/hometowndata.json')){
}
Do you have PHP allowed in your templates? It's an ACP setting (GENERAL tab, under Security settings).
Kailey Truscott - Community Team

Nick225
Registered User
Posts: 103
Joined: Sat Nov 24, 2018 7:48 pm

Re: unable to find correct path of file in subfolder

Post by Nick225 » Thu Feb 21, 2019 2:50 am

Yes it does work.. I had a typo in the file name all along.. :(
Sorry I didn't see your response before editing my post.
Thanks a lot for your quick response.

Post Reply

Return to “phpBB Custom Coding”