Create a system to edit texts of a website - text

Hello I'm making a website and I want that an user can edit some of the texts content in the website, clicking a button "Save" and the changes are permanent.
I suppose I have to put all the text in a database instead of keeping it in html code, but this will slow down the website loading performance.
Is there a library to easily achieve this functionality? Pheraps changing html code instead of acting on the database.

You have to read the file content and load it into a form in a textarea or WYSIWYG and after submitting the form, put the changed data back into the file. The codes for loading and saving data, depends on programming language. check the documentation for opening and saving the file in PHP here.
http://php.net/manual/en/function.file-put-contents.php

Related

How to only get the "title" and "main content" of a page using puppeteer?

I'm trying to create a clone of getpocket.com for learning. On that app, every saved link gets converted into a markdown; and it seems like the it's a filtered content with only the page title and body without headers, footers, etc.
I could get the page's title using puppeteer api thru different means:
using page.title()
or get the page's opengraph "og:title"
But how do i get like the summarized version containing only the main content of the page.
Note that i don't know beforehand the "css class" of the main content since i'm planning on just entering a url in a textbox and scrape that site from there.
I have found what i've needed for this scenario.
I used the Readability.js library for making webpages readable by removing some certain html tags. Here's the library.
This library is what mozilla uses behind the scenes when rendering their reader view

Downloading part of an EJS page as a PDF file

I have little developing experience and I would really appreciate it if someone could point me in the right direction with my little project.
Basically, I have this first page where the user fills a form via radio buttons. These choices all represent pieces of texts in the database. When the form is submitted, an EJS page is rendered where these texts are merged. I've managed to make it work this far using Node, Express and MongoDB.
As the next step I'm trying to give the user the option to download the generated text as a nice looking PDF file. What would you recommend me to use?
You can use tools like node-html-pdf which takes a picture from your generated html page from EJS and print it using an headless browser.
Note : Since PhamtomJS is deprectated, node-html-pdf's too.

Sharepoint 2013 - adding code to the master page

I’m trying to add some code to a master page, either directly after the opening body tag or before the closing body tag. To do this, I’m editing the .html version of the master page.
All looks good in the .html file, but Sharepoint adds a lot of extra code when the master file is generated from the .html file and my code never ends up where I need it.
Is there a way to make Sharepoint render my code where I want it, without having to directly edit .master?

CKEditor inline with Node.js

I'm trying to create minimalistic content management system with ckeditor using node and express as a server. I would definitely want to implement the inline editing capabilities of ckeditor, but I'm having no success in sending the data to server and finally to nosql (mongodb) database.
I would like to have multiple inline editors within a page and to save to my database them simultaneously upon a POST event. I have my editor instances in invividual divs with an attribute contenteditable="true". Editor instances launch just fine, but when I'm trying to grab the data in my controller, all I have is an empty object. I can get the data from input fields, but then I lose the inline editing features. I've tried tinkering with bodyparser, but no success. All my divs containing the editable content lay under a HTML form element.
I would be more than happy is someone could at least point me to a general direction of how to accomplish this. Sorry if I was unable to make my self clear posting this question :)
tldr; How can I parse data from HTML elements, other than input-fields and text areas, in node/express with bodyparser?
Content of non-input fields won't be posted in a form, so you can't do that. A couple options come to mind:
Use JavaScript to update hidden inputs on the page as those divs change. Updated content will be posted.
Use JavaScript to make the POST, on save grab the contents, post them to the server, and then after that make the redirect from client side.

Can I add a button to a CFGRID that lets a user export the grid to an XLSX file? How?

I'm a coldfusion developer working on a reporting application to display information from a CFSTOREDPROC process. I've been able to get the data from my query to display correctly in a CFGRID, and I'm really happy with the display of the data. The grid saves a lot of time because it avoids using the CFOUTPUT tag and formatting the data in HTML for hundreds of reports.
All I would like to do is add a simple Disk Icon somewhere on the datagrid control that would save the contents of the datagrid and export it into an XLSX(2010) file that an end user could then manipulate in a spreadsheet program. This is important because the data needs to have a 'snapshot' at certain times of year saved.
Solutions Tried:
I looked into having a link from the report options page that would fire into a report_xls.cfm page but designing a page that catches all of the report options a second time seems dumb and would add thousands of CFM's to the website.
CFSPREADSHEET seems not to work for a variety of reasons. One is that the server seems to constantly fight me with the 'write' function in this tag. Another is that I don't know how to make the javascript work for this button to get the output that I want.
I also looked into doing this as a Javascript button that would fire based on the data entered. Although the data from a CFSTOREDPROC will display correctly if I use a CFOUTPUT block, CFGRID seems to have a hard time with all output styles except HTML. This has caused some difficulty with these solutions because the application doesn't spit out a neat HTML table but instead sends a javascript page section.
Raymond Camden's blog contains an entry Exporting from CFGRID that we used in our project.
The example in the article exports to PDF, but it is rather simple to modify the download.cfm file to export to Excel files as well:
You modify the file to generate the <table>...</table> HTML from his example in a <cfsavecontent variable="exportList"> tag, so that the #exportList# variable contains the table that will be shown in the spreadsheet.
Next we have a URL parameter mode that determines whether it is exported to PDF or Excel.
So the end of our download.cfm looks like the following:
<cfif url.mode EQ "PDF">
<cfheader name="Content-Disposition" value="inline; filename=report.pdf">
<cfdocument format="pdf" orientation="landscape">
<cfoutput>#exportList#</cfoutput>
</cfdocument>
<cfelse>
<cfcontent type="application/vnd.ms-excel">
<cfheader name="Content-Disposition" value="report.xls">
<cfoutput>#exportList#</cfoutput>
</cfif>

Resources