First time i am working on CI project. I am having one linking issue.
header.php : (views)
<li class="">
<a title="" href="<?php echo site_url('index.php/welcome/index')?>">
<i class="icon icon-share-alt"></i>
<span class="text">Logout</span>
</a>
</li>
In Welcome.php : (controller)
public function index(){
$this->load->view('layouts/login');
}
From this i am getting this error:
( ! ) Warning:
include(F:\xampp\htdocs\payroll_crm\application\views\errors\html\error_php.php):
failed to open stream: No such file or directory in
F:\xampp\htdocs\payroll_crm\system\core\Exceptions.php on line 268
please help me with the same.I did not work on routing. is there need of routing?
Have you: Register/defined your route in application/config/routes.php in $route array?
You might wanna look: https://www.codeigniter.com/userguide3/general/routing.html
Related
have the following problem, and is that I need to redirect from a link which is created by me with 6 random characters to make a shortener to a file. The problem is that when I try to access the file I get the url http://127.0.0.1:8000/C:/Users/myUser/Desktop/proyect/public/assets/PDFs/file.pdf but I do not need this url, but the following, which would be from C://.
My doubt is, how could I do this? Since I can't find anything that can solve it and I have been trying for days to find the problem and trying in other ways, even with:
Storage::disk('local')->get($qr->document)
The blade code is as follows:
<a class="button shortlink" href="{{ route('shorten.linkDocument', $qr->code) }}" target="_blank"> <i class="fa fa-link"></i>
{{ route('shorten.linkDocument', $qr->code) }} </a> <br>.
Where it says $qr->code are the 6 random characters generated to act as a shortener and redirector. The route to shorten.linkDocument is found in Web, and is as follows:
Route::get('Pdf/{code}', '\App\Http\Controllers\QrController#shortenLinkDocument')->name('shorten.linkDocument');
The method referenced by the controller is as follows:
public function shortenLinkDocument($code).
{
$find = Qr::where('code', $code)->first();
return redirect($find->document);
}
PS: In $qr->document the absolute path from C:// is stored.
I hope for your help and thank you very much if you have read everything.
I have the following folder structure on my local -
xampp\htdocs\wordpress\wp-content\themes\mdbblog
on my local and under this directory, have following files -
I activated mdblog theme from http://localhost/wordpress/wp-admin/ and able to access the index page of my site http://localhost/wordpress.
The problem is I am unable to href any other page from home page.Following is my code to access Gallery in the menu -
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">Gallery</a>
<div class="dropdown-menu dropdown-primary" aria-labelledby="navbarDropdownMenuLink">
<a class="nav-link" style="padding:5px 10px;" href="./clinic-gallery-page.php">Clinic </a>
<a class="nav-link" style="padding:5px 10px;" href="patients-gallery-page.php">Patients</a>
</div>
</li>
When I click Clinic, I get following error -
I have no clue as what am I doing wrong here. I new to PHP and Wordpress. I also don't see any pages present under mdblog theme on admin. Is that expected? Any help is much appreciated.
Ok, sooo WordPress isn't exactly a file request type system.... WordPress will only resolve based on your db... Read te docs or ask more direct questions. I advise you:
Create a page. .. this pages will register a route (sortoff) on your db
Assign that page to your menu
Big warning. When you create a localhost page on development, this will be written like that on your db. When you take this to a production server, you will end up with some links as localhost and some as the domain. U will either always have to redirect, or before you upload your db to production, you can dump the sql, and do a find localhost and replace with your new domain on notepad ++
Unless you are creating your own theme. I wouldn't add files directly to your theme as it can be overwritten on an update. Create a plugin.
I have a HTML5 file respectively a simple webpage.
and I have a php file.
this file includes a function getKursname(string)
The function is working properly when called in the php file.
This all happens on XAMPP.
I now want to update some values and strings in my html page.
this should happen only on load.
this ist a code the code in the html:
<div class="w3-bar" id="myNavbar">
<a class="w3-bar-item w3-button w3-hover-black w3-hide-medium w3-hide-large w3-right" href="javascript:void(0);" onclick="toggleFunction()" title="Toggle Navigation Menu">
<i class="fa fa-bars"></i>
</a>
<i class="myfont icon-heart"></i> HOME
<i class="myfont icon-users"></i> ÜBER UNS
<i class="myfont icon-th"></i> KURSE
<i class="myfont icon-mail-alt"></i> KONTAKT
</a>
</div>
I want to have the innerhtml (e.g. KONTAKT)
to be read from the database.
the php function returns a string.
I can call the funcion with getKursname(string) within php.
my idea was:
<i class="myfont icon-mail-alt"></i>getKursname("kurs1")
but this is not working... :-(
thanks in advance
Dirk
Assuming you have a directory structure similar to this:
www/
index.html
functions.php
and you want to inject the content before the index.html is sent to the browser.
In which case, the solution would be, to rename index.html to index.php and at the point where you want the output of the function, you write
<?php include_once 'functions.php'; echo getKursname("kurs1"); ?>
(or require_once instead of include_once, and you have to include it only once before it is used, to load the function definition)
however, standard is to put includes in the header:
index.php
<?php
require_once 'functions.php';
?><html>
<head><!-- ... --></head>
<body><!-- ... other stuff -->
<?=getKursname("kurs1");?>
<!-- rest of page -->
</body></html>
to clarify: <?=[something] ?> is short for <?php echo [something] ?> and everything between <?php and the next ?> is evaluated by php, everything else (like the html code) is just printed as is.
This is my code :
<li>
<i class="menu-icon fa fa-paper-plane"></i>
Deportasi
</li>
I want to make link to another page using tag in navbar list, but when I insert php script to call a controller inside the html causing next script wont read/not running. It works on my another project, but IDK how it causing error in this project.
Hope this will help you :
*Note : make sure u loaded url helper in autoload.php or in your controller like this *
$autoload['helper'] = array('url');
Try with site_url() instead of base_url() if u not remove index page using .htaccess
<li>
<i class="menu-icon fa fa-paper-plane"></i>
Deportasi
</li>
Try Doing This Way It Should Work
<li><i class="menu-icon fa fa-paper-plane"></i>Deportasi</li>
I include two files in every view, which are nav.php and footer.php.
All session varaiables and base_url() are working in nav.php file, but when I want do the same in footer.php it is not working.
url helper file is autoload via config/autoload.php as
$autoload['helper'] = array('url', 'file');
I spent whole day to figure it out my self but it's not working.
nav.php
<ul class="nav navbar-nav">
<li>Post New Project</li>
<li class="dropdown">
Projects <b class="caret"></b>
<ul class="dropdown-menu">
<li>All Projects</li>
<li>Featured Projects</li>
</ul>
</li>
<li class="dropdown">
Funds <b class="caret"></b>
<ul class="dropdown-menu">
<li>Upload Funds</li>
<li>Withdraw Funds</li>
</ul>
</li>
</ul>
footer.php
<ul class="footer-list">
<li>Login</li>
<li>Register</li>
</ul>
In my viewname.php file I'm calling them as
<?php include('includes/nav.php'); ?>
Other code here
<?php include('includes/footer.php'); ?>
nav.php working fine but footer.php not working.
autoload.php
(Line :67) $autoload['helper'] = array('url', 'file');
config.php
(Line :17) $config['base_url'] = 'http://localhost/cl';
Probably an echo is missing?
And make sure that autoload is not declared more than once.
In order to use base_url(), you must first have the URL Helper loaded (which you have done). This can be done either in application/config/autoload.php (on or around line 67):
$autoload['helper'] = array('url');
Or, manually:
$this->load->helper('url');
Once it's loaded, be sure to keep in mind that base_url() doesn't implicitly print or echo out anything, rather it returns the value to be printed:
echo base_url();
Remember also that the value returned is the site's base url as provided in the config file. CodeIgniter will accomodate an empty value in the config file as well:
If this (base_url) is not set then CodeIgniter will guess the
protocol, domain and path to your installation.
application/config/config.php, line 13
EDIT:
Change the following
include('includes/nav.php'); // Other code here
include('includes/footer.php');
to
$this->load->view('includes/nav.php');
// Other code here
$this->load->view('includes/footer.php');
I wouldn’t use this method in an MVC framework since there is no need with $this->load->view. Another thing is the paths have to be absolute/relative which mean if you did change the folder structure you have to go update all include statements. Its really against MVC structure. If we there is ability to do this using parser or defined methods then why we call view in another view:)