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>
Related
I have finish all my html pages and now I want to add them inside the header.php.
Please see the code below:
<li class="menu-item"> AboutUs </li>
As you can see Iam using the_permalink function to call the html file , but when I click in the navbar the aboutus nothing happen , I dont get the aboutus.html.
Can you please tell me how to ge to my point?
You do not output anything from PHP. Change <?php to <?=:
<li class="menu-item"> AboutUs </li>
<li class="menu-item"> AboutUs </li>
$location_of_file will contain address to aboutus.html file without slash at the end.
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.
<li>SERVICES</li>
<li>ABOUT</li>
<li>CONTACT</li>
I'm using CodeIgniter and this code was in a different controller. suppose http://localhost/defctrl/function1
I want to return to my homepage "maine/home" in a specific div when you click on the list but the above code doesn't work. neither ../maine/home#services.
How can I solve this problem?
if it's on the same page you can use
<li><a href="#services"
if another page
<li><a href="<?php echo base_url() ?>{route or controller name}#services"
Make sure URL helper is loaded and site load with index.php
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:)