-
-
-
PHP explode/split string by HTML tags
If you want to reliabally grab anything in a html document or block of html, its best to treat it as html as such: $html = 'html contents or file <img src="smiley.gif" alt="Smiley face" height="42" width="42">'; $doc = new DOMDocument(); $doc->loadHTML($html); $tags = $doc->getElementsByTagName('img'); foreach ($tags as $tag) { echo $tag->getAttribute('src'); } This would loop and print out the src attribute of each image, hopefully helpfull, and easily modifiable for a first item, or other uses in future.
-
-
Duplicate of site on different domain with minor changes
Given the context, if it is purely a CSS/style based change then I would use a switch on the CSS served in the header, however I suspect over time there could be more deviation on the content/style at which point wp multi site or switch themes on the fly (rough example http://wordpress.stackexchange.com/questions/3761/switch-theme-on-fly). If you switch themes you could make use of child themes of the master, thus making change easier. There are also ways to allow a single WP install serve multiple domains (sites) by loading the DB and thus resources based on URL (using a switch statement).
-
Forum Error - serializer.php
Same error here (still ongoing), Seems to be intermittent on submitting a forum post/reply although when reporting a spam post it is continuous - so hopefully the report got through
-
Backing up Wordpress in it's Simplest form?
Hi Chris, The simple answer is indeed yes, so long as you have a copy of the files and indeed the database you will have the necessary files to re-install the site. There are however steps you would need to take if you were to migrate the site to an alternative domain however from such a backup. There are a few plugins for this and a quick google reveals this: http://wordpress.org/plugins/backwpup/ looks to have the features you are looking for and is indeed free .
-
Moan, Grumble, Whinge...
I suppose it’s about time to weigh in, this is probably more on the comical side Receiving a tech call from a company with a small coms centre on the recommendation of an old colleague. Following a brief run through of their systems, the problem and a two hour drive we arrive and followed up with the resident tech. Turned out the tech had never thought to check if the units where turned on, instead simply proceeded to show us “I usually come in and press this button [monitor power button] and the system is always there”. Lesson learned, always be specific when you ask “have you tried turning it off, and on again”
-
PHP and Visual Studio Express
I’d certainly have to side with Rallport against the use of Visual Studio for PHP, although understand that you will be tied to it for the C# and ASP end of the spectrum. Id perhaps take a look at PhpED by NuSphere if you’re looking for an alternative PHP IDE. As it certainly is as feature packed as VS, but with little overhead. A feature that will possibly be the most useful will be the debugger, as this is practically identical to that offered by VS for C# or other programming languages. With line-by-line execution, variable/data and environment usage etc both in a virtual or live environment and as such will feel very familiar. From memory there is a demo and indeed a student licence if (as i suspect you do) have a university .ac.uk email.
-
-
-
importing users into wordpress
Although I’ve never really tried it with WordPress it would make sense that if you where to locate the section in the old WordPress installation (if this is the case) in the wp-config.php that defines the Salt values/auth keys and copy and paste to the new install I couldn’t see why it wouldn’t work. The section looks like this: /**#@+ * Authentication Unique Keys and Salts. * * Change these to different unique phrases! * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service} * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again. * * @since 2.6.0 */ define('AUTH_KEY', ' '); define('SECURE_AUTH_KEY', ' '); define('LOGGED_IN_KEY', ' '); define('NONCE_KEY', ' '); define('AUTH_SALT', ' '); define('SECURE_AUTH_SALT', ' '); define('LOGGED_IN_SALT', ' '); define('NONCE_SALT', ' ');
-
Warning: Cannot modify header information - headers already sent by ...
Hi Stallman, Looking over your code I can only see one real obvious point of call and that is your database, what would be the result if you were to comment out the line you have highlighted? Do you have display errors enabled in your PHP ini?
-
-
Automating Your Web Design Business - Tips & Tricks
Certainly a good idea to automate a lot of the contract generation, I have to admit we do something very similar, although through a modified/custom wiki software that pulls data from various places I.E git servers, server monitoring software api’s, the wiki itself and other places to generate a lot of overview type documents… certainly saves time. On the thought of Git or indeed SVN, we’ve seen and ourselves adopted the use of git to deploy/update 50/60 + WordPress installs simultaneously as we use a stock (custom) WordPress setup as our boiler plate and modify the appropriate .gitignore to push updates to both WP and plugins across rapidly. As for freshbooks, checkout Xero (UK) http://www.xero.com/ , We ourselves and a number of our clients use/ have used them. Their software is really feature rich whilst being perfectly intuitive whilst still keeping an accountant happy. Also good on a price front.
-
Wordpress Vs. Static HTML
It’s certainly interesting to see that the perception of a basic/flat HTML site has moved forward to the extent that they are now considered to be powered at least to some extent as a basic CMS. Which through good code practice/reuse to save time and increase maintenance certainly makes a great deal of sense, even at the basic end of the scale with PHP includes for common page elements (header/footer etc). I do however have an opposing thought as to the use of light CMS’s or in particular custom CMS’s as opposed to the likes of WordPress. Such that the power of WordPress or any other similar major CMS, is in its users… as we as humans will find something we like, that works and always invent new or additional features or additions. This is evident and greatly supported in WordPress among others with its community in particular providing a plethora of options premade with little to no cost or overhead. Some of the smaller light CMS’s certainly do have similar features and some support certain add-ons but not to the same extent. I quite like this idea of marshalling change as a counter to the use of such CMS’s as I’ve certainly seen what happens when a user gets a hold of a perfectly optimised and setup WordPress installation, however could this in most such CMS’s not be facilitated by providing the user an account with lesser administrative power (author) ? Alternatively perhaps having two versions of WordPress, light and standard… with slim line or primitive features In respect of the code/core through the use of the standard database structure which could/wold allow a full featured install to simply place over the top if/when needed? A Hybrid if you will? is it not light enough allready?
-
-
Foot firmly in mouth
I’d certainly throw my hat into the ring, very much a dab hand at coding but am more than experienced as a project manager and that side of things in general being a software engineer.. SCRUM would probably be a good for this kind of project alongside git etc.. also a notice board (card tool) called trello.com (free) is also particularly useful.
-
Speed freaks - post your scores
I might have to look into wp total cache again, as it certainly might benefit some of the sites we’ve recently developed… on a few basic tests across the network I also noticed quite a difference among some WordPress sites to others that had identical plugins and roughly similar content. The only main differentiation factor being the time at which the themes had been developed (or last updated) such that a theme lasted updated in 2008 achieved 88/100 - 36 - 2.73s - 294.8kB in comparison to the linked with a larger page size and number of requests. Certainly interesting what a clear difference the code or quality of the code to a lesser or greater extent is clearly playing it seems. Recently developed WP site. Pingdom link Wordpress CentOS CloudLinux environment - Apache
-
I need Help! I need a simple calculator for my website!
Hi Jimmy, Could you post your .html file code as you have it in Dreamweaver onto here for us to take a look at?, it will certainly help in getting you an answer both now and for future posts. Ensure you use the code option when posting (<> icon) though. Also I've made some slight modifications to the code Lyndsey provided to ensure the code runs when your page loads, as it appears JSfiddle was providing this for Lyndsey, you also need to include the other line below as jQuery is required. I've included a complete up-to-date example below that will work. Tip - You will notice the JavaScript is at the bottom of the page as opposed to the top, this is the best place for your JavaScript as it will allow your page to load more rapidly before loading the JavaScript and is often advised. Required to include jQuery in your file. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> Up-To-Date Version: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <select class="sel" id="sel1"> <option value=""> Select a Value... </option> <option value="10"> 10 </option> <option value="20"> 20 </option> </select> <select class="sel" id="sel2"> <option value=""> Select a Value... </option> <option value="70"> 70 </option> <option value="80"> 80 </option> </select> <input type="checkbox" value="50" name="myChk" id="myChk" /> Add Service (50) <br /> Total: <span id="total"> </span> </body> </html> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script type="application/javascript"> $(document).ready(function() { var totalElement = $('#total'); $('.sel').on('change', function() { totalElement.html( parseInt($('#sel1').val()) + parseInt($('#sel2').val()) ); }); $('#myChk').click(function() { if($(this).is(':checked')) { totalElement.html(parseInt(totalElement.html()) + parseInt($(this).val())); } else { totalElement.html(parseInt(totalElement.html()) - parseInt($(this).val())); }; }); }); </script> Hopefully that helps
- emailing php generated table
-
Parsing XML Response
As per the above and JordanC's rather apt tutorial I would use simpleXML, although as opposed to using cURL you can/could simply use the function shown in the tutorial simplexml_load_file() and insert your appropriate URI to the api and avoid the use of cURL entirely as it would be unnecessary. http://php.net/manual/en/function.simplexml-load-file.php