CodeIgniter Forums
Loading static html pages without modifying hrefs and srcs - 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: Loading static html pages without modifying hrefs and srcs (/showthread.php?tid=64154)



Loading static html pages without modifying hrefs and srcs - dylenbrandon - 01-20-2016

Hey all. New to CodeIgniter. Loving it so far. I'm currently using software that generates an index.html page along with css,js,img folders. Is it possible for me to server an entire static page without having to modify the contents of the generated page. The issue is that when the view is served, the javascript, css and images aren't found because of the base_url. Modifying each link in the generated software is not ideal, and will be troublesome when I need to reimport more generated pages. Any idea what can help in this situation?


RE: Loading static html pages without modifying hrefs and srcs - PaulD - 01-22-2016

You would really need to provide an example of how your pages are being created, static links, relative links etc.

However, you can just add a folder called 'pages' to the root, load all your pages into there, and within your CI page views just add normal links to the page you want to link to. You may need to add an exclusion to .htaccess if you are running it, but links just ending in .html is normally enough.

As for missing images and scripts, where are the pages looking for them. A simple solution would be to create whatever folder structure they are looking for and upload the scripts and images.

Hope that helps,

Paul.


RE: Loading static html pages without modifying hrefs and srcs - josepostiga - 01-22-2016

Have you tried using base_url() helper function? https://codeigniter.com/user_guide/helpers/url_helper.html?highlight=base%20url#base_url


RE: Loading static html pages without modifying hrefs and srcs - PaulD - 01-22-2016

@josepostiga - I think he wants to generate pages in another application (perhaps even a windows based one) and use the generated pages in or with CI without modifying them.