I downloaded Markdownify from http://milianw.de/projects/markdownify/ and extracted it to my application/libraries/ directory.
I did a:
$this->load->library('markdownify');
echo $this->markdownify->parseString('<b>Test</b>');
But the output is the same html markup. It didn’t work. How do I get it working?
Have you tried renaming it to markdownify_helper.php, place it in your application/helpers/ directory and loading it so:
$this->load->helper('markdownify');
Related
I'm running a web only server (So no server access and no things like Composer or LibreOffice) and I want to convert a DOCX template to PDF. I have succesfully processed my template with PHPWord (Downloaded using php-download.com since I can't use composer), everything fine there, but when I try to use DomPDF (also downloaded through phpdownload) to convert my docx file to a PDF file, PHP throws me "Class 'Dompdf\Dompdf' not found"...
I created a seperate file to just convert an already known docx file just to exclude any environmental issues
This is my code:
require_once("includes/PHPWord/vendor/autoload.php");
$inputfile = "files/temp/offerte_Hankie-Pankie.docx";
$path = realpath(realpath(__DIR__) . '/includes/dompdf');
echo "realpath: " . $path;
\PhpOffice\PhpWord\Settings::setPdfRendererPath($path);
\PhpOffice\PhpWord\Settings::setPdfRendererName(\PhpOffice\PhpWord\Settings::PDF_RENDERER_DOMPDF);
//Load temp file
$phpWord = \PhpOffice\PhpWord\IOFactory::load($inputfile);
//Save it
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord , 'PDF');
$xmlWriter->save('result.pdf');
Using the echo I confirmed the folder is set properly: "/home/myusername/domains/mydomain.nl/public_html/projects/pdftemplate/includes/dompdf"
So i tried parsing the subfolders "src" or "lib" without success, I tried parsing the actual autoloader file "autoload.inc.php" and didn't work either. I tried all of the above paths with and without ending "/" (Just to be sure) and still class not found... Even though I'm using exact copies of code found to be (presumably) working on the internet.
I tried finding it in the PHPWord documentation, which didn't give me any solutions. I also tried excluding PHPWord and just using DomPDF, but since DomPDF only accepts html as input, and I don't know how (And didn't want spend another hour trying that) to convert docx to HTML, this was also a dead end.
Just as a reference, here is my file structure:
Work dir
CodeIsInThisFile.php
includes
dompdf
lib
src
Autoloader.php
autoloader.inc.php
PHPWord
vendor
autoload.php
So either I messed something up in my file structure because of the manual downloads (Which seems the most likely to me), or my code is wrong (Also likely)...
First download the dompdf library using composer or using git.
Use the realpath() or try to use the absolute path for PDF rendering library.
I want to open and manipulate a SVG graphic with PHP. I found there is a PEAR class XML_SVG. This looks great, but seems to only create new files. I did not find any load_svg() function that loads an existing SVG from file or string.
Is there a way to load an existing SVG file and then manipulate it with Pear XML_SVG?
There is not. I went through all the files.
https://github.com/pear/XML_SVG
I'm trying to include file from another php framework but doing so it's giving me an error failing open the stream for the files which are included inside the file I'm trying to include.
Any idea on how to include it properly so that the files included inside my included file are able to be processed?
What Framework are you using?
I have little experience with templates but I don't think you should be adding PHP code to a template file.
Click Here for another question on how to add PHP code to a template file.
However as far as your path goes, try using:
include("../../other/index.php");
Your include only looks only one directory up.
include ("../../other/index.php");
would be two directories up so into the "admin" directory then the "other" directory
This has been asked before here
I have a php script in a folder "root/test/index.php" which calls another php script located in "root/app/run.php"
In the run.php file I change the php's working directory with a call to chdir to simplify my require_once paths
All the php includes work fine, however HTML paths are totally messed up.
To make my style.css works I have to use a path relative to "root/test/" even if my style.css is in "root/app/".
This works:
<link rel="stylesheet" type="text/css" href="../app/style.css">
and that goes on for all HTML sources like img etc.
How can I change HTML working directory too?
I looked in php/HTML documentation, but I have find no good solution.
Any clue?
Thanks in advance.
HTML don't know anything about the working directory of your PHP script.
The HTML is sent to the client who can't know what was the working directory.
You could add some redirection in an .htaccess file (if you are using apache) to redirect root/test/ to root/app or something like that.
Here is how it works :
You browser ask for /root/test/index.php
Your server handle all his things and then output HTML file
Your browser parse the HTML file
If it find something like that it will search the image here : /root/test/images/cat.png because you are viewing the /root/test/index.php file and you provide a relative path
Add a comment if you have more questions.
I'm currently working on a drupal theme but keep having problems with getting the theme to read the damn css file. I started off theming with the Framework theme, I tried organising the files on there for example creating a subdirectory to store the CSS file, change the setting in the .info file so it knows it's in the css folder, but it won't read the damn file.
Fast forward a few days and I've got 60% of my theme styled and layout-ed, so decided to port everything into a new theme folder rather than the Framework theme folder. Organised the folders and files, but again it won't read the CSS file whether I put it in a subdirectory or in the same directory as the .info file. It somehow worked once, but then went and hasn't worked again.
I've tried clearing the cache etc, but to no avail.
I'm working on a local wamp server. Drupal is latest version 7.
Any ideas how to fix this problem?
Thank you
Wich version of Drupal you are using? In Drupal 6 this works fine:
/* mytheme.info */
stylesheets[all][] = assets/css/master.css
stylesheets[all][] = assets/css/typo.css
This files are in my Theme folder
Folder: MYTHEME
File: mytheme.info
Folder: assets
Folder: css
File: master.css
File: typo.css
I know this is a bit late but maybe it will help someone else.
I'm using Drupal 7 and I attempted to add a javascript and stylesheet file in a custom module in the .info file.
module.always.js
and
module.always.css
It would load the first but not the second. I even put the stylesheet above the script in the info file and it would still just load the first file. Thought it was the directory and tried adding quotes around the file paths but that did nothing. Also thought it was the extra . in the file name but that didn't matter either.
The only way I could get both files to load was to remove them from the .info file and add a drupal_add_js and drupal_add_css for these files in the module_init() function.
No clue why that is the case but at least there is a work around.