I am using smarty 3 .its not working in subfolder.
Folder Structure
WWW
->admin
->cache
->configs
->libs
->plugins
->templates
->templates_c
index.php
In index.php [Root Folder] it working correctly.
But in admin/index.php it not working i am getting error.
here is my code
require_once('../libs/Smarty.class.php');
$smarty = new Smarty;
$smarty->display('index.tpl');
Error :
Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'index.tpl'' in D:\wamp\www\libs\sysplugins\smarty_internal_templatebase.php on line 127
After reading some stackoverflow answer i added $smarty->template_dir = "/templates"; but still i am getting the same error.
Please help me thank you
The content of $smarty->template_dir is relative to the actual directory. (if it is a relative directory.)
It means if you call a admin/index.php then it searches the templates in the admin/templates directory by default. (without adding anything.)
So in the admin directory you should use:
$smarty->template_dir = "../templates";
or an absolute directory.
Otherwise I think you should read this page:
http://www.smarty.net/docs/en/variable.template.dir.tpl
Especially this sections:
It is not recommended to put this directory under the web server document root.
Related
I've installed a pre-made Laravel app and followed the documentation to extract it to the public root except in the documentation they are installing it into public_html, but I have it in a subdomain in a folder named "test" which is on the same level as public_html.
All the CSS and JS should be loading from the public subdirectory, but they try to look for it in the main root folder.
For example, this file returns a 404 error:
https://test.mydomain.com/css/style.css
The file is actually at this location:
https://test.mydomain.com/public/css/style.css
The absolute path of the file is:
/home/mydomain/test/public/css/style.css
Instead of:
/home/mydomain/public_html/public/css/style.css
What environment or config file isn't set correctly and how do I set it to use the correct directory?
UPDATE
Changing the ASSET_URL to "public" fixed the first issue, but now the same thing is happening with the admin.
The app tries to load the dashboard with this URL:
https://test.mydomain.com/admin/dashboard
The page loads all the assets normally when I remove the word "admin" from the URL:
https://test.mydomain.com/dashboard
But this doesn't work for all the pages.
You can try to put public directory path in below given conflagration file.
Config File Path : config/app.php (asset_url)
'asset_url' => env('ASSET_URL', 'https://test.mydomain.com/public/')
I'm trying to connect the folder public with Laravel but I can't
API is in another folder called Laravel01
I've changed the url on index.php
require __DIR__.'/../laravel01/vendor/autoload.php';
but I can't step back to the root folder
Fatal error: require(): Failed opening required '/homepages/15/d831964969/htdocs/api/../laravel01/vendor/autoload.php' (include_path='.:/usr/lib/php7.4') in /homepages/15/d831964969/htdocs/api/index.php on line 24
it keeps on api folder when it must link with laravel01 folder
sorry for my English and I hope everybody can understand me, thanks a lot
I uploaded Codeigniter 4 to a shared hosting in a subdirectory.
I can access the installation (the default controller) if I go to http://example.com/ci4/public
but how can I access the default controller if I want to use http://example.com/ci4/
I already added http://example.com/ci4/ in App.php as baseurl. But currenty I'm getting a page not found error.
Try this okay.
I hope it will work
I discovered that when I try to point all my url to public/index.php in my project it return error 404 based on it can't find my controller after rewriting my .htaccess to point to public/index.php in my project root directory.
This is how I solved my problem =>
I move the index.php and the default .htaccess from public directory to my project root directory then I edit the index.php to locate my app directory
E.g
index.php Default find this line
// This is the line that might need to be changed, depending on your folder structure.
$pathsPath = FCPATH . '../app/Config/Paths.php';
Change it to
// This is the line that might need to be changed, depending on your folder structure.
$pathsPath = FCPATH . './app/Config/Paths.php';
I hope this work for you
I'm getting the white screen of death on my joomla site. I am using php7.3.
I have added this to my htaccess file
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php70” package as the default “PHP” programming language.
<IfModule mime_module>
AddType application/x-httpd-ea-php70 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
My hopes were that it would solve this issue, but it did not. On the frontend of my site, visitors see a white screen only. On the administrative side of my site, I am seeing this error message.
Warning: session_start(): Failed to read session data: user (path: /var/cpanel/php/sessions/ea-php73) in /home2/webwiza2/public_html/libraries/joomla/session/handler/native.php on line 260
Error displaying the error page: Application Instantiation Error: Failed to start the session
I reviewed the path identified as "/var/cpanel/php/sessions/ea-php73" and the php directory level doesn't exist; not sure why the native.php would reference a directory that doesn't exist. I have my hidden files showing. In other words when I go to the /var/cpanel/ directory I only see one folder and it is not 'php.'
I rolled back my Joomla to the previous version and re-installed; updated my ini & htaccess files with the appropriate version references and all went well after that.
I was trying to install an extension in my magento site which was failed in the middle later i could not get access to my admin neither to my site as it shows this error.
http://prntscr.com/68qc3c
this error should be removed maintenance.flag file but this file is not available in my root folder. Please assist me if there is any other way possible?
Thanks
two possible ways are
1 . you can delete manually both session and cache directory from var directory.
path
magento_root/var/
2. or you can delete all files of that extension and reinstall again.
The maintenance.flag file must still be in your root directory, otherwise Magento would not be displaying the 503 error. The way that this is displayed is a result of the index.php file, around line 66:
$maintenanceFile = 'maintenance.flag';
if (file_exists($maintenanceFile)) {
include_once dirname(__FILE__) . '/errors/503.php';
exit;
}
This page cannot even be cached. Re-connect to your FTP server and check for the file in your html directory on the webserver. Alternately, speak with your web hosts & have them remove the file.
As a precaution, you can try deleting your var/cache directory and see if that makes a difference.