Web sites built by the simple way often have a main html document that the html code is written in it.
If a user right clicks on the browser and select "view page source" then the name : "Example.html" will appear as page source.
That file then can be found in the web site's root directory.
My question is : what about joomla? Where is that main file?
What if I want to put some code in the page that I see on the front end, where do I do that?
Joomla doesn't contain any html files for displaying content, the only html files you will find are blank.
Joomla uses 2 index.php files. There is one in the template folder where all the HTML, CSS and Javascript is pushed to and the other is in the root of your Joomla site where all applications get pushed to one loaded.
When you view the page source code for a Joomla site, you are simply viewing the structure that has been pushed to the index.php file from various locations, such as from modules and components.
Update
Ok, I think this might be best done in the index.php file of your template. First, in the Joomla backend, get the ID of the menu item that link to the page that you wish to use for your code. Once done, add the following code to the index.php:
<?php
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$menu = $app->getMenu()->getActive()->id;
if ( $menu == 1) { // change 1 to the ID that you got from the Menu Manager
$doc->addStyleDeclaration('
//css goes here
');
$doc->addScriptDeclaration('
//javascript code goes here
');
?>
<p>hello world</p>
<?php
}
?>
Related
I have multiple html pages with the same navbar. I recently put the navbar in it's own navbar.html file and use ajax via jquery.get() to dynamically load the navbar onto my pages, as opposed to repeating the code across all my pages.
There is currently no stylesheet on the navbar.html, as the style gets applied when the navbar gets loaded back onto the calling page.
Should I be including the .css in the navbar.html, also? They would both be referencing the same 2 stylesheets. I assume that's possible, but haven't yet tested - it will definitely make it easier to make changes to this file in the future. What's the best practice here? I will not be using any server side code.
Please also let me know if there is a more conventional way to do this; I haven't had any luck searching. (I come from a .net web forms background, so would just use a master page there.)
Any relevant links would also be appreciated.
Check the snippet
First you have to make you pages index.php
Then include your navbar.php to index.php using <?php include'navbar.php';?>
Use below method to active the button on each pages
1- Define your page name <?php $page = 'company';?>
2- Define a active class in css file
3- Call the active class to button
<!-- begin snippet: js hide: false console: true babel: false -->
I've developed a custom HTML homepage for my prestashop site, but it seems I do not know how to incorporate it, I've tried looking into the prestashop forums, but all it shows are for .tpl files, is there a way for me to link them to the homepage?
Can I just link it as an html page or do I really need to put it inside a tpl page for it to work?
Create your .html file (say 'test.html).
In test file you need to
add these lines of code before your html code
<?php
include(dirname(__FILE__).'/config/config.inc.php');
Tools::displayFileAsDeprecated();
include(dirname(__FILE__).'/header.php');?>
Also add these lines after your html code
<?php include(dirname(__FILE__).'/footer.php');?>
Place the test.html file in the public_html folder.
Now you need to add the page to link with your site.
If it is home page you need to add it to index.php otherwise you can just add the url (http://mysite/test.html) to menu bar or footer links, where ever you want to put it.
I have placed my php page link in the footer information part using anchor tag as shown in the image
In prestashop you can find "Home Editorial" module, in this module you can put your html obviously the module need to be transplant in displayHome position.
I made a static html page and i wanted to run this page using wordpress locally (wamp).I put all the necessary files to wp_content->themes->theme folder name ,such as footer.php index.php header.php functions.php style.css and made one page template called custompage.php and one page-about-us.php.I have made my pages from wordpress dashboard and i mannually made navigation menus by adding some code to functions.php and loaded three theme locations to wordpress appearance->menus->menu settings.My links to my pages seem to work fine but my problem is when i click to a page for example page-about-us.php doesnt display the content from edit pages wordpress dashboard but display what i code in my page-about-us.php file.In other words I want when i link to a page display the content i write in wordpress edit page.I suppose this is done with functions.Which functions or what to do for fix this?Thank you in advance.
to retrieve data from the page about-us wordpress admin dashboard i only had to code while(have_posts()) : the_post();
the_content();
endwhile; inside the page-about-us.php file
Alright, I don't know how exactly I'm going to phrase this, so bear with me here. Is there a way to set a default HTML page? Like is there a line of code that I can use on new html files to load a local .html file for almost a template?
Use any sever-side programming language to include header and footer parts of your default webpage.
Example on PHP:
<?php
echo file_get_contents("header.html")
?>
Your page contents
<?php
echo file_get_contents("footer.html")
?>
You can set default html page in your webserver. But that's just if someone hits http://server/ with no page name it tells what page to use like http://server/index.html versus http://server/default.apx, etc. Has nothing to do with templates.
If you want to be able to include html files inside other html files, you probably need a serverside language like ASP, PHP, JSP. HTML itself doesn't have that capability, although some webservers might offer a custom tag that is translated on server-side for includes.
The default web page on a server must have the name index.html, index.htm or sometimes default.htm. It is possible to change the server to accept other file names as default files, but those are the most commonly used ones. What is the index.html page?
If you're asking how to make your web browser open a default page when you open it, this is usually called the "Home Page" and any file or page that you can visit in your browser you can assign as the home page.
If you're trying to create a template for a web page, there are many ways to do it. The PHP example listed above is one way. You can also do it with JavaScript. Write your HTML in document.write() calls inside a file named navigation.js and then place this script where you want that code displayed:
<script type="text/javascript" src="navigation.js"> </script>
However, this is not unobtrusive and could cause problems. Another way to do it is with Server Side Includes. Write a file named navigation.ssi and then add the following SSI line to your HTML where you want the included file to display:
<!--#include virtual="/ssi/navigation.ssi" -->
You can also do it with ASP and other methods. I explain in more detail in my article How Do I Include One HTML File in Another?
I have a wordpress website (self hosted blog), but now I need to create a page like http://www.example.com/testpage.html.
How can I do this? How this person has done it? http://lukepeerfly.com/demos/iframe/html.txt
there are few ways to a "landing page" in your site. here's 2 methods:
1 - you can create a page in the cms and then make a template for it.
For example, we wanna make a page named "landing". We duplicate the page.php file in our theme and change his name to landing.php (as described here: http://codex.wordpress.org/images/1/18/Template_Hierarchy.png).
Then, in the page's code, in the top, we'll write the template name in the right syntax:
< ?php
/*
Template Name: landing
*/
?>
//other html/php code here
You can include the header, footer, sidebar, or choose not to include them.
the page url will be www.mysite.com/landing.
2 - The second way is to create a file outside your theme folder, in your server's root directory or in some designated folder (using a ftp connection, ofcourse). in the example you brought, http://lukepeerfly.com/demos/iframe/html.txt, html.txt is probably located in root\demos\iframe directory on the server.
your new file will be outside the wordpress. if you do want the file to be a part of your wordpress system (you need it if you want to use wordpress functions, hooks, database and etc) you'll need to include the "wp-load.php" file in the start of your code.
For example, our page, "landing.php", is directory "pages" in my root directory. in the page's code we'll write the following lines:
<?php
require('./../wp-load.php');
?>
//other html/php code here
In here as well, you can include the header, footer, sidebar, or choose not to include them.
the page url will be www.mysite.com/pages/landing.php.
you can just create the .html file and upload it to your FTP server and then link to it in your wordpress blog.