I am using Simple Html dom parser to get simple data from other websites and then be able to paste it into my wordpress pages via shortcode using elementor.
I created a simple plugin which I uploaded together with 'simple_html_dom.php' libary.
The plugin is this:
<?php
include('simple_html_dom.php');
function web_name(){
$html=file_get_html("https://www.google.com/");
return $html->find('title', 0);
}
add_shortcode( 'name2' ,'web_name' );
?>
It works properly in local through XAMMP and VScode but when I include this [name2] shortcode in Elementor I only get blank, not even error.
If I modify the plugin function with:
return "Hello";
The shortcode works fine.
Thanks
Related
I know how to implement CodeMirror to a regular page but I have no idea how to do it on a MediaWiki webpage. I've tried adding the "codemirror.js" file the same way I added other scripts that I am using on the page but I get the error that "CodeMirror" is not defined when it is being initialized. In the code below shows how I added my previous scripts and the "codemirror.js".
$wgResourceModules['ext.SpecialRobotExp'] = array('scripts' => array(
'module/PID.js', 'module/grid.js', 'module/saveFile.js', 'module/codemirror.js'
),
What I need is to know where to save the codemirror.js file and how to load it to the page on a MediaWiki webpage.
i want to print a html to a pdf. In the project i use symfony and twig to render the template. When i return the html to browser it's looking good.
And it should be about 10 pages.
But when i try to create the PDF, i just get two pages.
$html = $this->render('offer/print.html.twig', array('offer' => $Offer ));
$options = new Options();
$options->setIsRemoteEnabled( false );
// instantiate and use the dompdf class
$dompdf = new Dompdf( $options );
$dompdf->setPaper('A4');
// Render the HTML as PDF
$dompdf->loadHtml( $html );
$dompdf->render();
$dompdf->stream();
PHP 7
Symfony 3.0.9
dompdf 0.7.0
It doesn't looks like the html in the browser. I have to debug the css later.
Can anyone tell me why i just getting two pages in the pdf?
interesting it seems the problem is the render() function.
When i use renderView() instead i got my output over multiple pages.
render() also returns the HTTP Headers. Out of this reason i got a broken pdf with the header information on the first side and all content on the second.
Just the CSS isn't working but this is another issue :)
Please upload you twig file. I think the issues with you twig css.
My links to anchors aren´t working and I don´t know why. I guess it is something about the server where I have my site uploaded.
I tested my page on a free server and localhost and there are no troubles, it only happens on the server. Any idea why this might be happening?
The sidebar at the right contains the links that get you to spots on the same page, just works once, but when the page finish loading, doesn't work anymore
This is the page:
http://www.fumigacionesmillenium.com.ve/
I am inspecting the source and JS console, there seems to be lots of JS errors after I click the link on the right. Attaching a screenshot:
i think meta tag is not closing proper.Please check below image
I installed a plugin called Slideshow, i´m using Wordpress, the reason of the error:
TypeError: jQuery.easing[jQuery.easing.def] is not a function
It was a conflict between the Jquery that loads the plugin and the Jquery that loads from functions.php, solved it this way:
code before:
if( !is_admin()){
wp_deregister_script('jquery');
wp_enqueue_script( 'material-jquery', 'http://code.jquery.com/jquery-2.1.3.min.js', array(), '1.0', false );
}
code after:
if( !is_admin()){
wp_deregister_script('jquery');
wp_register_script('jquery', ("http://code.jquery.com/jquery-2.1.3.min.js"), false, '2.1.3');
wp_enqueue_script( 'jquery');
}
Now i can use the plugin without problems, and my anchors are working perfectly.
I'm using bootstrap and jQuery CDN for my web app and I'm just wondering is there a way to not having to go to bunch of my files and paste the CDN links and scripts and instead just put it all in one place?
Let's say that I can't save bootstrap or jQuery locally or make the web app a single page web app.
I believe Require.js can do this but I'm not sure how or is there another JavaScript libraries that can do this?
First let me state the obvious, that most CDN's include minified versions already.. but there are several options to do this on your own. See here for others.
I've used this one, JShrink.
Here's an example using a list of CDNs:
To include your scripts..
$scripts = array(
"https://code.jquery.com/jquery-2.1.4.js",
"https://code.jquery.com/ui/1.11.4/jquery-ui.js"
);
foreach($scripts as $script)
echo "<script src='minifier.php?url=".urlencode($script)."'></script>\n";
Then minifier.php looks like this..
<?php
include('vendor/autoload.php');
$minifiedCode = \JShrink\Minifier::minify(file_get_contents($_GET['script']));
header("Content-Type: application/javascript");
echo $minifiedCode;
You can inject any CDN in your page's header using the below Javascript in your javascript file of the app. But you at least need same javascript file linked in all pages with this script.
function loadjscss(filename, filetype){
if (filetype=="js"){ //if filename is a external JavaScript file
var fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript")
fileref.setAttribute("src", filename)
}
else if (filetype=="css"){ //if filename is an external CSS file
var fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet")
fileref.setAttribute("type", "text/css")
fileref.setAttribute("href", filename)
}
if (typeof fileref!="undefined"){
document.getElementsByTagName("head")[0].appendChild(fileref)
}
}
loadjscss("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js", "js");
loadjscss("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css", "css");
I have an HTML page with an <iframe> that loads an HTML form. The form inside the iFrame posts to a PHP script.
Upon completion of the PHP script, how can it load an entirely different HTML page outside of the iFrame?
not in php, php syntax is
header( 'Location: url' ) ;
but it only works if you havent done anything else yet.
but you can do it with javascript like so
document.location.replace("url")
or
document.location.href = "url";
so with php you can write (after form is submitted)
echo "<script>document.location.replace('url');</script>";
or
echo "<script>document.location.href = 'url';</script>"
edit
i changed window (redirects iframe) to document (redirects page) i should work now, sorry about that.
you can also use top.window.location i think.
a simpler way to do this is in the actual html <form action="url" target="_top">. however this will skip form-validation.