Pull portion of web page from a page hosted on another server - html

I'm working on a company site that's hosted on a separate server from the main site. So, for example, I'm working on guest.company.com, and the main company website is www.company.com, and the two sites are hosted on different servers (and different development solutions).
The project I'm working on has a copy of the css from the main site, and has a shared layout with html copied from the main site. This shared layout is used for the top and bottom (header and footer) of the site I'm working on. However, I don't want to use a copy of that layout and html -- I want to actually pull in the layout & css from www.company.com so that when a change is made to that content on www.company.com, it's reflected on guest.company.com.
So, for example, the bottom "footer" area of www.company.com is contained in a footer html tag, and I want to display that content on guest.company.com.
How can this be done in MVC4 EF?

There is no quick fool-proof way to do this.
The quick way to get the HTML is making a webrequest call from your code and get the html and take what you need from it (i.e. header and footer). Have a look at this msdn link for an example of how to perform this. With that, you don't need "the other side" to do anything.
Having said that, it's potentially more complicated than that. As mentioned in the comments, css path should be made absolute. But there could be images (both within html and css). Also, if header and footer run any javascript, they need to be included in the page as well. You could of course include every single JS file that is referenced in the www.company.com page but there are sometimes JS run on the page. Your webrequest call wouldn't run the JS. In order to make sure all the javascript is run and the FINAL HTML is produced, you can use PhantomJS.
As you have probably noted, it could turn into a lot of work depending on what's on the header/footer. In my experience, a potential solution would be to have an FTP location that www.company.com copies the header/footer and their assets in. You can pull it from there every 24 hours or something.

Related

Identical HTML not rendering the same

I have a program that let's people design web pages graphically. Then hitting Publish creates an html file that is supposed to be an exact copy of what they created. The elements created by the editor are HTML elements. Publish then gathers up all the elements that have been created and for each one adds it to a string with
canvasOuterHTML += clone$[0].outerHTML;
So all the styles, text, etc., get put on the string. This string, along with some other information is written to the .html version of the page, and when this .html is loaded into a browser the browser displays the page!
But something is expanding the published page vertically. I've created the simple page below to illustrate. The first image is the page in the editor. The second image is what the html displays in the browser.
I'm completely stumped because the HTML and CSS for the two markups is exactly the same, so how can one be higher? I can't even think of a mechanism that would do that. Does anyone have any ideas? Thanks.

Can I break away from rails asset pipeline?

In my Rails webapp I would like to have a view that only gets its css from a specific css/scss file. I have tried several suggested solutions on here but none to my avail.
However, would I be able to place the example.css.scss file outside of the assets/stylesheets directory and restrict the view file example.html.erb to the example.css.scss styling only for example.html.erb?
From what I understand by reading rails asset pipeline all files in the myapp/app/assets directory inherits its css rules from the application.css file and as well the corresponding css file when the controller is generated creating a view file, css file, etc. etc.
I've created a webapp using Ruby on Rails. The app is almost done and is staged. I had an idea that a landing page would be a nice opener to the webapp.
My goal is to create a landing page for webapp. The landing page consists of a background image with a text centered link, which I would like to link to the home page of the webapp and not receive any styling from the application.css file.
Basically I want this view file to have nothing to do with the application.css file.
Thanks in advance.
While there may be reasons to use a totally different css file that's not part of the asset pipeline (e.g. landing page working while rails is restarting, keeping landing page lightweight, etc.), my guess is that you're more motivated by getting something to work.
I'm assuming you've got styles for most of your app that would conflict with the landing page, so if the styles from app apply also to the landing page, the landing page looks funny, and vice versa. So my guess is that you're looking for a way to have some styles apply to the app, and other styles apply to the landing page.
For this, I would first of all bypass your regular layout - see bypass application.html.erb in Rails app
Then, I would update your regular layout to somehow indicate that it is the app and not the landing page. There are any number of ways to do this, but I might do the following:
application.html.erb:
<body class='app'><!-- etc. -->
landing_page.html.erb:
<body class='landing_page'><!-- etc. -->
Then, in your scss files, update it thus:
application.css.scss:
body.app {
/* All your regular app styles */
}
body.landing_page {
/* All your landing page styles */
}
Of course you can split those into multiple files, etc..
TL;DR
Unless you're running into loading time issues or you have some other reason why you really really don't want app styles loading for the landing page, then just put it all together but scope the styles so that they don't apply when they shouldn't.
You are already working in the Rails domain, so it would probably be easier to continue to stay in that domain.
In my opinion, the best/easiest thing to do would be to create a welcome controller. Create an empty index action in the controller and a view for that action. The view you are creating seems rather simple, so you can just prefix the class/id names (which don't seem like many) with welcome_ and this will differentiate them from your normal class/id names. The link for the homepage text will point to the index action of that particular controller.
Then you can create the root route in your routes.rb file to point to welcome#index.

Index page in Joomla

I have made a homepage in Joomla 2.5, and I need my front page to be different then the page made in Joomla.
My best solution then, is to make the front page in pure HMTL, and then redirect to the site made in Joomla. Is this possible? or is there an easier way to do it? for example with a plugin or something?
Create a custom html page and create it an article and then assign this article to front page. In this way you can display your custom html page to hope page of joomla.
Further if you want to remove even the headers and footers of the joomla page for home page this can be done in various ways
Make module positions and display the header and footer in it an
then in admin do not publish these modules for home page
We have
variable in template index.php which give us flags weather this is
home page you can use this flag and put a condition like if this is
home page dont display the header and footer.
Hope it will help you.
I can't really understand your question. If you want to load HTML only use custom HTML module rendered in your homepage
What are you trying to achieve? Without knowing more, I have two thoughts.
a. Joomla uses index.php. A lot of the time web servers look for index.html first. So if you create an index.html file and upload it to your root folder, it will display that first and not read your Joomla! site. If that doesn't work, check your web server to see the order that it looks for your start page. That is a setting that can be changed. (Depending on your hosting situation)
or b. You can set different templates for a single Joomla! site. you could set a different template for the homepage compared to the rest of the site. (I just need to know more on what you are trying to accomplish)
Have a great one.

Page url links to pages internal frame

I have a personal website, which I have made (to the best of my ability) without a template. I am not very experience in HTML so am not entirely sure if this is bad practice or not, but here is my issue.
My website consists of a frameset, which has 3 frames. Two do not change (banner and nav panel), and the other is content. The way I display my content in the main frame is through an iframe. Here's where the trouble comes. I have suggested my website to the crawler, and it crawls all the pages for content, of course. When I click on one of my links suggested by google (say, a project), the browser loads that individual .html file, without any of the rest of my frames. In other words, it does not link to the page through my index.html which sets up the formatting and page frames, but simply loads the html as a stand-alone page.
Is there a way I can avoid this, so that if a link for my website is clicked from an external link (not from my domain), the page first loads my index.html, and then the page of interest, so that it appears as if it were accessed normally from my index? I am not sure whether I should find a new way of displaying my content in the main frame so that it avoids iframes, or just need a simple script to redirect the user.
Not sure if it's useful but I've attached a photo of my page just to better explain what the frame layout is that I am working with.
Many thanks!!!
iFrames are definitely not the route to take when you are displaying consistent content... Which from what appears to be the Navigation, Header, and of course, the Content. Of course there will be an issue when a "Search Engine Spider" crawls your page... From my understanding, seeing as you are calling "content" from another page, the spider will crawl that page but will not crawl the index.html page we are currently viewing. When a "Spider" crawls a page it looks for STATIC HTML Tags/Content/Keywords/etc, and seeing as you are calling all of your content from other pages the "Spider" will treat that content as being on another page as well.
You want me recommendation? Avoid using an iFrame at all times. The point of an iFrame is to display content from another location (external), and or display static content on a page without having to scroll the current page you are viewing the iFrame on.
It is bad practice to use an iFrame, I would suggest using DIVs. Within these DIVs you may place content, images, links... Virtually anything you want, with all of the benefits of having people view your website, along with Search Engine Spiders.
I hope this helps!
Thanks,
Aaron
iFrames are a bad choice. AJAX is VERY simple these days. Just replace the big iFrame with a Div, and AJAX a page, putting the contents into that Div.
Replace your anchors with tags, and replace href with name, like so:
<div name='main.html' class='link' />
You need a div with the id 'loadHere':
Then include jQuery (it's pretty easy, google it) and at the end of your HTML put this:
$('.link').click(function(){
$.post(this.name,function(dat){
$('#loadHere').html(dat); }); });

Site navigation : setting a ribbon/header constant

I believe this is a HTML/CSS question - how you set a header or ribbon constant. As in, just have the body change. For example the facebook website. When you click on Profile, the body of the page changes, but that bar stays the same. Same when you click Home.
Thanks !
I didn't look at the FB code but in essence, to answer your generic question, they are two different pages with the same code for the toolbar.
On one side you have the web page page layout and design, on the other you code it: say PHP, ASP, etc with using a template engine.
This way you can place the code for toolbar, content, footer, etc and later merge it on you way, producing "similar" paging reusing the same parts.
The PHP, ASP, etc code is responsible to "decide" which menu, option, ... must be highlighted to indicate the section you are.
Other way is the AJAX way, like google gmail, where the content of the page changes dinamically requesting new content via AJAX and not reloading the page.