Navigation html pages liferay portlet - html

I'm new in liferay, into my portlet i have html pages with angularJs not jsp.I would ask about how to navigate between these html pages into my portlet..thanks.

I think you are bit confusing about technology.
JSP pages always generate HTML page for your browser.
It means that you create a JSP page containing just HTML nothing changes (this is correct from a developer point of view... thinking to server job this is not true... but think it is true for our purpose).
Client side technology you are going to use is not relevant from a portlet point of view (it can be a problem if your theme uses some not compatible libraries...) but in general whatever library you use (angularjs, backbone etc.).
It means that you can create html or jsp pages containing all the angularjs code you want... and everithing should work fine.
If you want to manage navigation between "pages" in the same portler (e.g. from view.html to details.html) then you have to mind, simplifying, that portlets haven't pages: your portlet will be added in a page of the portal (with its own URL).
So you can rename your html files in jsp files (as I told, nothing changes), then you can tell to portal what is the correct URL to load by JSP code.
For example for making a link to "details.jsp" in your "view.jsp" you can write a code like following:
<a href="<portlet:renderURL>
<portlet:param name="jspPage" value="/path/to/your/details.jsp" />
</portlet:renderURL>">Text</a>
Obviously you can use the <portlet:renderURL>...</portlet:renderURL> code wherever you want... because it will be translated in a string before sending to browser... like in javascript var url = "<portlet:renderURL>....</portlet:renderURL>"
You shouldn't forget to put these lines at the beginning of yout jsp files:
<%# taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<portlet:defineObjects />

Related

Programatically modifying a HTML page from ASP.NET

I have an ASP.NET web app with a standard default.aspx, from within which I need to load a html page from another site (all internal intranet) and pre-populate form input controls on that loaded html page using ASP variables. Specifically, username / pwd on a login form based user details loaded by the aspx from a db. The html page also contains a considerable amount of js (shouldn't directly impact this question though).
Not sure of the best route to approach this. I have considered:
1. Loading the html page in a frame, then somehow manipulating it's DOM from another frame loaded from the aspx.
2. Loading the html during aspx page load or render, then replacing the relevant sections of the html with the new values.
I have had a stab at both approaches and ran into issues. With (2) the resulting HTML isn't recognized as HTML by the browser at all (despite the written response being just the original html relayed from the original site). I can see the HTML source in the browser, but the page itself appears blank.
Answers warmly anticipated. Thank-you.
1.if you want to go wityh iframe
You can easily modify values from communicate between parent window and iframe
from parent to iframe function
document.querySelector('iframe').contentWindow.ChildFunction(33);
from chhild to parentfunction
parent.parentfunction("4rom child")
make a function in iframe that accept an object (from parent) and populate it in.
make a function in parent that accept an object (from child) .
2.how are you "Loading the html during aspx page load or render,"
- ajax or something else?
-making a user controll
both should work fine .
( could you tell how are you loading html ?)(as it should have worked)

Creating a plain html home page AMP with WordPress running the other pages

Gday
I like to know how you would go about creating a home page in plain html and have WordPress run the other pages?
The reason is I’d like to create a solely plain html website but I need WordPress for my contact page it has a large form on it and I use a plugin to generate it and forms are a bit beyond my knowledge at the moment to create a contact page myself.
(I have tried creating a template page but then WordPress adds unnecessary code [from plugins ] and makes the AMP invalid)
Honestly I'd try and keep it self contained in WordPress itself.
If for some reason you really want a separate HTML/PHP Homepage, follow these steps:
Add a my-homepage.php file to your /wp-content/themes/ACTIVE-THEME directory
Inside that file put the following code:
Add a new page (Pages > Add New)
Give it a recognizable name like "My Homepage"
In the "Template" selector on the right hand side, pick "My HTML Homepage" and click Publish
Go to Settings > Reading, change Your homepage displays to A static page and pick the page you just made
Now you can add your own code as you see fit. Nothing "WordPress" related will get loaded or hooked in since there's no functions on that file - so you're free to code HTML (or PHP) to your heart's content.
You can see a bit more indepth answer over on WPSE: https://wordpress.stackexchange.com/questions/296592/how-to-use-custom-html-file-instead-of-wordpress-homepage

asp.net MVC: different scripts in pages

I have pretty simple landing site (index, faq, about, contact) based on ASP.net MVC. Of course, I use Layout (with head and footer), every View contains just page content. The problem: some pages has unique footer or head.
For example:
Index page has carousel (only this page, other pages has no carousel).
In source HTML (that web-designer sent me) I see scripts links in the head and scripts block in the end. Yes, I know: I can use Razor tag "#section" and declare this non-standard head and footer inside my view.
But! It means my view (page content) includes razor syntax. This is not pure HTML. What if site admin will want to edit index page - he will see Razor tags, he can't use some html editor or online tool (TinyMCE) for edit. He must know Razor. He can't just insert pure html.
Maybe I shouldn't keep page contents in DB? (but this site must support multi-lang). What is the best approac in this case?
Thanks.

Alternative to frameset in jsp

I have login button in the left side of the web page, now I want this to be available at any page in my site, however I don't want to reload the whole page all the time, when the user login I want to keep his name constant on the left side which is there for the all site.
I want to avoid frameset this is realy problematic for my site.
The site id built with JSP.
what are the options.
I thought of using <jsp:include page=''> and try to change the page url dynamicly but this is impossible since it is compiled to servlet and this it server side.
Also if I include leftSide.jsp in each page than leftSide does reload for every page.
please advice, there must be a solution for this simple and very common problem.
You can use <%# include file="login.jsp" %> in all pages. The login.jsp can contain the common code
You can use a template engine, like tiles, freemarker or sitemesh.
With either of these, if you don't want to reload, you need ajax. Perhaps using jQuery.
call the login/logout server-side action using ajax
update the box (make it a <div>) accordingly, with javascript

one TMLH footer page to show all my web page

i am making side all pages static html
i want to make footer another page and i want to show all my web page
because when i have to make change in footer then i will have to change all of my web pages its so difficult i want when i change one page it will appear all pages
how can i do it please help me i am using html pages
Thank's
There is no way to use this using straight HTML - you will need some server side technology - PHP, ASP, Server Side Includes, etc.
Here is a pretty basic break down of some of the options. http://webdesign.about.com/od/ssi/a/aa052002a.htm
Sure no problem. when testing from your hardrive IE will bring the content in, google will not. from a website all browsers will work.
add this to the bottom of your html pages:
<span id="include_footer"></span>
then add a jquery ajax call to get the footer data and replace the span content in the head of html page:
<script type="text/javascript">
$(document).ready(function () {
//include the footer html
$.ajax({
url:"footer.html",
context: document.body,
success: function(response){
$("#include_footer").html(response);
},
error: function(response) {
alert('error loading file');
}
});
});
</script>
Enjoy :)
I see that you're using HTML. Have you considered using PHP? All you need to do is change your page to .php instead of .html and you have a php page. Now, if you make a page, say footer.php, on each of your pages your can add this line:
<?php include 'my/file/path/footer.php'; ?>
Anything that you have in your footer.php file will be included in that page.
Common web servers allows you to prepend or append contents to all pages on particular web app.
For instance in IIS, you can select a an html file for every document you web server returns:
it could be found in the IIS website/app properties then in Documents tab.
For Apache Server:
http://perl.guru.org/scott/hobbies/apache/
For purely static HTML, some IDEs can handle this effectively. In Dreamweaver, you can create a template that your site will use. This template can include an editable section and a non-editable section that contains your footer. You then create pages based on this template. When you update the template, Dreamweaver will handle updating all other pages on your site that are based on that template.
Edit: This is an example of a template in Dreamweaver that I made a couple years back for a group project.
The Bobs (Screenshot)
The area surrounded by the blue-green rectangle is the editable region (for pages created based on this template).