Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
So I have a file that's already constantly being update on my server, but the directory currently isn't in my wwwroot folder until I can actually meddle around in there to get the directory to change.
So question #1 is if it's possible for my site to actually access this file away from the wwwroot? If not, it's okay. I'll find some way to get it in there.
This is however the more important part of this question. The file in question is currently in .data extension and contains a field such as {"cpu":30,"ram":300000}. It's been updated in real time with an application in the background, but how would I get my web page to pull those data and display it? I only started learning HTML and CSS several days ago, so my knowledge is still pretty limited here.
I cannot understand your first question. :S Please, could you be more clear?
For the second one, to read the text file you need a javascript code. You can do that as follow:
1º Open the file: file = fopen(getScriptPath("myFile.txt"), 0);
2º Get the content of the file in a string: file_length = flength(file); content = fread(file, file_length);
3º Finally, you can get the part of the string you want by a regex.
Pulling data from external sources and displaying it in HTML is a very common practice the purpose of programming languages like PHP. You aren't going to be able to do it with just HTML/CSS. Stick to static (unchanging) pages until you've got HTML/CSS down, and then you can learn a scripting language to make dynamic pages.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 11 months ago.
Improve this question
I used inspect-element to change words and images on a website for a project and then saved the newly edited site as a file, but after working fine the first few times I ran it. The file started to show up weird. It originally looked like the linked Clickhole.com article that I've linked albeit with my modifications. And now shows up broken. So I was wondering how to make the file look right again.
It might be because the file was originally ran in on a Google-chrome laptop but doesn't know what to do trying to run on a Mac or Windows computer but I'm not sure.
How the edited code shows up
How it originally looked
You would need to download all the assets the HTML file is pointing to, like the images and style.css. Or you could add a base tag in the head element of the HTML file to make the website look for assets in the original.
<base href="https://clickhole.com/overstepping-her-bounds-j-k-rowling-has-announced-tha-1828826710/">
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
Getting my head banging since this morning to do this simple (I think) thing:
I want to create a link (manually) that automatically selects the third Tab and adds some text to this webpage:
http://www.acessibilidade.gov.pt/accessmonitor/
I've tried some ways, including http://www.acessibilidade.gov.pt/accessmonitor/?#form3 but to no avail... what I am really missing here? Is even possible?
Thanks in advance.
If you dont have access to edit this page's source code then you cannot do what you are suggesting with a simple url or querystring value.
If you could edit the page then you could add some JavaScript or server side code to open the tab you specify in the query string/url.
Fancier solutions include proxying the site and injecting your own javascript or simply re-writing the html but this isn't really recommended as any such solution would be very fragile and the owner of the original site may not be too happy with you doing that.
You could also use a browser automation tool like selenium.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
So I'm working on producing my own version of a web/db project my friend was given in school. This is my first project in either area and I'm still learning. Part of the project description mentions all of the pages the client wants. I'm solving this by making an unordered list of links to the different pages with appropriate labels. Complex, I know.
Then I realized that every page will have this. My question is this: is there a way to class certain portions of code in html, so I can just have a "navigation list" in each page, instead of the full code of the list and everything associated with it, in every page?
I want the code to be clean and efficient. That's my motivation in this question.
Your question provides little detail, but it sounds like you want something like a php include. If you are running your site on your local, change the .html files to .php and do <?php include('includes/navigation.php') ?> where includes/navigation.php is a path to JUST your navigation code.
What you are talking about is templates. You cannot do it in plain html... You would need to use a server side language like php. You could also do it with a JavaScript templating language like handlebars or similar, but not in plain html.
If you don't want to use PHP or some other server side technology for a simple menu, you can try various Javascript plugins like MenuCool.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
In an attempt to learn HTML, I thought it may be a good idea to edit some simple code. So, I navigated to what I figured was a simple layout on a website and copied the source to my desktop. I made minor changes and attempted then to reopen the HTML file in a browser to see the changes.
Instead of the same layout with a few minor adjustments, the entire scheme was deformed. The wording was all there(no longer formatted), but the background was now white and all the links appeared structrually in one column on the left side of the screen.
So, in essense, what is the best way to learn HTML and why didn't my attempt at editing work? Are there more files required than provded by a simple source save provides?
The HTML likely references things by RELATIVE PATH, e.g. a CSS File included with /styles/... not http://originaldomain.com/styles/... So if you just saved the HTML, none of the relative paths will resolve. Most browsers allow you to file --> save page as, which will copy not just the file but also the resources.
Try www.w3schools.com/html/ should give you a good start and a good understanding. Don't try and run before you can walk! And try learning CSS aswell
The file you needed was an external CSS file. It is linked to in the head of the document. This site is better than w3schools, www.w3fools.com
There are a lot of videos out there. Try www.reddit.com/r/learnprogramming
That community is much laid back and friendly!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Hello I have an html page that through php pulls reports about sales and puts them in charts and graphs. It works great however I am looking for a way to convert a div box into a pdf so whoever is using the sight can print specific graphs and charts that are in selected div boxes. Is there a simple way to do this or is this unfeasible?
Thanks!
There are lots of answers here merely talking about making a PDF. That's the easy part - the hard part is finding an engine that renders the CSS well.
This question has been raised before, and the issue doesn't lie with feasibility (it's very possible and there are lots of solutions), but they vastly differ on their capabilities to translate CSS into PDF. Many just completely fail altogether.
From my research it looks like WKHTMLtoPDF is your best bet, as it uses a full WebKit engine to render the HTML first, then translate that into a PDF (I found a tutorial in addition to the docs).
The downside? It's command-line, so you'll need to engineer a solution involving either python or php to execute the program. Here's the PHP manual on executing a program.
Edit:
I have personally used FPDF before, which is a surprisingly light-weight solution with a caveat that you have to provide it with all of the HTML (edit:) line-by-line, rather than being able to use the browser-rendered result of a HTML page (a result that would include a rendered chart). I'm providing it merely as a suggestion and to help you work out where you can go from here, but it's not directly applicable to your complex CSS/chart problem.