Tag: php

Flat-File Content Management System (CMS) Code

Creating a Content Management System (CMS) can be a daunting task, especially for those who are not familiar web development. However, with the right tools and knowledge, it is possible to build a "simple" flat-file CMS using PHP. A flat-file CMS is a lightweight and easy-to-use system that does not require a database to store content. Instead, it uses text files to store data, making it ideal

Using Javascript in PHP Code

Simpe method to use JavaScript inside PHP without all the messy code is a global function: function js_link($src) { //set root path to scripts folder if(file_exists("my/html/root/" . $src)) { //we know it will exists within the HTTP Context return sprintf("<script type="text/javascript" src="%s"></script>",$src); } return "<!-- Unable to load " . $src . "-->"; } Then use: echo

WordPress use PHP & JavaScript in Widgets

Resolve adding the following code to the WordPress theme function.php file. HIGHLY recommend creating a child theme and using functions.php from that theme. add_filter('widget_text','execute_php',100); function execute_php($html){ if(strpos($html,"<"."?php")!==false){ ob_start(); eval("?".">".$html); $html=ob_get_contents(); ob_end_clean(); } return $html; } To enable shortcodes in the Text