Problem trying to render FusionCharts Gantt chart in Wordpress - wordpress

I am trying to render a Gantt chart in Wordpress. I am created the xml file on the fly with data from MySQL tables, saving the xml and then calling it with the new FusionCharts function. However, I am getting an "Error in loading data".
I have the php files saved as template filed in a child directory under my theme directory and the script runs fine when creating the xml files. However, if I under the Network tab in the browser debugger, I am getting 404 errors when trying to read the xml files.
The code that I am using to read them is
$readchartfilename = "./wp-content/themes/uncode-lite/ocga_pages/".$chartname.".xml";
$columnChart = new FusionCharts("gantt", $chartId, "100%", 200, $chartname, "xmlurl", $chartfilename);
Report post
Posted just now
Hello,
I am trying to render a Gantt chart in Wordpress. I am created the xml file on the fly with data from MySQL tables, saving the xml and then calling it with the new FusionCharts function. However, I am getting an "Error in loading data".
I have the php files saved as template filed in a child directory under my theme directory and the script runs fine when creating the xml files. However, if I under the Network tab in the browser debugger, I am getting 404 errors when trying to read the xml files.
The code that I am using to read them is
$readchartfilename = "./wp-content/themes/uncode-lite/ocga_pages/".$chartname.".xml";
$columnChart = new FusionCharts("gantt", $chartId, "100%", 200, $chartname, "xmlurl", $chartfilename);
If I run an echo on the getcwwd() - I get /home2/calypso/public_html/ogca and on $readchartfilename, I get - ./wp-content/themes/uncode-lite/ocga_pages/LadybirdFarms.xml.
But the files that the FusionCharts function is under the folder of the page name (farm-crop-production) URL -
http://example.com/ogca/farm-crop-production/wp-content/themes/uncode-lite/ocga_pages/LadybirdFarms.xml
which is incorrect as that folder does not exist.
I have tried the code outside of Wordpress and it works fine.
Would appreciate any assistance.
Thanks
Steve

Related

How to access html file inside iframe in production

I am creating a web app where, this app will generate a .html file in public/ directory. And after that i want to show that generated html file on a page using iframe .
I am using NextJS for this task. I have configured next.config.js for rewrites but getting 404 error. I am using Railway for hosting. Since in Vercel we can not access filesystem here.
Instead of generating html dynamically, if I upload that .html file, then i can access that file using iframe in production.
I think we can not access those files which were not available during build process. (this is my guess , maybe wrong)
How can I solve this problem or should I use another framework ?
Thanks
Since I was accessing .html files (i.e <iframe src="path-to-file"></iframe>) which were not available during build process, that's why i was getting 404 error.
So I did the following thing:
suppose I want to do this <iframe src="/pdf/page01.xhtml"></iframe> where file location is in public/pdf/page01.xhtml.
so this src is sending a GET request to localhost:3000/pdf/page01.xhtml.
To manipulate this request I created a pages/api/pdf/[...slug].js. In this file you can use process.cwd() to access the file inside your public dir. You read file content using fs.readFile and send the response res.status(200).send(data) like this.
By doing this I was getting the desired result.
Suggestions are always welcome.

GoogleDrive downloadURL is not populating

I am trying to integrate Google-docs UI with ASP.NET Web application.
In this files are stored on our file storage and We want to open Google Docs Editor to edit the word/excel/PPT files.
As a part of POC for this requirement, I am doing below:
Uploading file into Google Drive using below code:
Dim objInsert As Google.Apis.Drive.v2.FilesResource.InsertMediaUpload = objDriveService.Files.Insert(objFile, objStream, sMimeType)
objInsert.Convert = True
objInsert.Upload()
Getting response after upload and using objFile.AlternateLink
property to open the Editor to edit file.
I am facing the issue to download the file when I am using
objInsert.Convert = True. when I am making the call to File object
my Download URL (objFile.DownloadUrl) is not returning it is set
with Null. If I don't use the objInsert.Convert = True then I
am getting Download URL but problem is then AlternateLink open the
file in View mode with various option, I want the URL to open it
directly in editor.
Please suggest what am I missing here.
UPDATE: this was already asked here: DownloadUrl missing from metadata for file on Google Drive API
I think it is the expected behaviour. You can't directly download a Google file type, you have to export it to some compatible format.

Custom Error Page in Shiny

When visiting a page pointing to shiny app, such as myshinyapp.com/NoSuchPage.html, shiny will return "Not Found" information page. I suppose it is error 404 page.
How can I replace this "Not Found" page with my own page?
Thanks.
From section 2.10 of the manual:
Shiny Server can utilize custom templates when generating static pages such as directory indexes and error pages. This feature is controlled using the template_dir directive and can be applied globally, or to a particular server or location.
To utilize this feature, you'll need a directory in which you'll store your templates. In this example, we'll assume you're using /etc/shiny-server/templates/. Inside this directory, you'll place the handlebars-enabled HTML templates for your pages.
Shiny Server will attempt to find a specific page to accommodate the current need -- for instance, if it encountered a 404 error, it will first look to see if you provided a specific template for handling 404 errors in the specified directory (error-404.html). If it doesn't find this file, it will go one step backwards to see if you provide a generic error template (error.html). If it can't find a suitable template in your template directory, it will fall back to use the provided templates that come with Shiny Server (and are stored in /opt/shiny-server/templates).
As you may have noticed already, Shiny Server uses a hyphen-delimited hierarchy which progresses from broadest to narrowest. So all error pages start with error. But the file name for a 404 error page would add an additional element (404) following a hyphen: error-404. All files are expected to use the .html extension.

Asp.Net export to Excel error : Problems During Load, Missing .css files

From my asp.net website, I export data into excel using Microsoft ReportViewer. When I open the excel I get the following error
When I export few rows of data, it works fine. But when I export some what huge data, it throws this error. Can some one provide some help?
The data you are exporting is referencing css files on the webserver.
once you are downloading the file, you are downloading those references.
When you open the file, it's trying to open the css file's locally, but they do not exist locally.
I would either download the css files separately, and place them in the local location they should exist in, or prevent your export from referencing the files in whichever line has the references. (probably near the top)

ZIP file download tries to download page

just putting this out there to see if anyone has any good off-the-cuff suggestions.
I have a web page with a button that triggers the download of a PDF file. When I run this page up in development from within VS I get the file coming back for download as expected, however since moving my web site to a staaging environment it is now yielding a very different result: When I click the download button I instead get an error and a message which seems to indicate that the call actually attempted to download the raw ASPX page rather than any ZIP file.
As this works so painlessly in my development environment, I'm assuming this must be down to environmental/configurational differences. Has anybody come across this before and if so could you inform me of the error of my ways?
Many thanks in advance
Ian
Could the aspx file be the actual zipfile ? Have you tried downloading it and open as zip?
Does the server allow for aspx to execute, eg mime-settings ?
Maybe this helps Filename and mime problems - ASP.NET Download file (C#)
Or look here How to retrieve and download server files (File.Exists and URL)

Resources