CodeIgniter Forums
call another html page not working - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: call another html page not working (/showthread.php?tid=71119)



call another html page not working - kvanaraj - 07-08-2018

I am having one html file. I am using navigation bar contained lot of menus. each menu call one html

Actual program.
*************
 <li><a href="#edu">Education</a></li>

#edu 
---some html files ----


I want to be
 <li><a href="edu.html">Education</a></li>

I will not open. in the page view source If i click that link , it's open . whats wrong in my code


RE: call another html page not working - php_rocs - 07-09-2018

@kvanaraj,

It depends on where the page exist on the website. Is edu.html at the root of the web site directory or is it in a subdirectory? for example:
www.mywebsite.com/edu.html
or
www.mywebsite.com/subdirectory_name/edu.html

Also, are you sure that the page name is edu.html (not edu.php)? Can you get to the page directly? If so, what is the url that you use?


RE: call another html page not working - Wouter60 - 07-09-2018

Why is this question in the CodeIgniter forum?
CodeIgniter typically doesn't call any html pages. You access pages through a controller that loads a view, optionally after getting data from a model. That's why it's called the MVC approach (Model - View - Controller).


RE: call another html page not working - php_rocs - 07-09-2018

@Wouter60,

I actually disagree with your statement. Yes, CI is an MVC framework but it is versatile enough to be able to make a call to an html page.


RE: call another html page not working - kvanaraj - 07-09-2018

(07-09-2018, 09:29 AM)php_rocs Wrote: @kvanaraj,

It depends on where the page exist on the website.  Is edu.html at the root of the web site directory or is it in a subdirectory? for example:
www.mywebsite.com/edu.html
or
www.mywebsite.com/subdirectory_name/edu.html

Also, are you sure that the page name is edu.html (not edu.php)?  Can you get to the page directly?  If so, what is the url that you use?

http://localhost/project1/about.html
this about.html is in same project1 directory


RE: call another html page not working - php_rocs - 07-10-2018

@kvanaraj,

This is a choice of absolute or relative links. I prefer absolute links because no matter where the link appears it will always work where as a relative link will only work based on the location of the page (if you use relative link in sub directory it will not work).

I would make your link like this:
Create a PHP variable in the html file so that you only have to change the site url once through the file (You could also do an required or include file of variables)
<?php $url = 'https://www.yourwebsite.com/'; ?>

Then down in your html page
<li><a href="<?php echo $url; ?>edu.html">Education</a></li>