• Hi

    I’m a Windows sysadmin and have been asked to help restore some custom PHP functionality for a group I’m involved with – they recently changed their website design & hosting and can’t get their custom code running. Whilst I know Windows very well, it’s fair to call my WP/PHP skills almost non-existent so please be kind ??

    I have a backup of their custom PHP but have zero thoughts on how to make it live – I’ve tried Google and these forums but honestly don’t know enough to make use of what I find.

    The code starts

    <?php
    class WeatherPage2 extends Page {
    }
    
    class WeatherPage2_Controller extends Page_Controller {
    	private $objWeather;
    
    	public function init() {
    		global $objWeather;
    		parent::init();
    		$objWeather = $this->getWeatherzoneObject();
    
    		/* echo "<pre>";
    		die(var_dump($objWeather));*/ 
    	}
    	
    	private static function getWeatherzoneObject() {
    		// get key
    		$date = time();

    and continues for pages.

    I believe the code is fine but I just don’t know how to integrate it into the WP site (plug-in?, additional config file via FTP?, some form of magic?) – any ideas would be gratefully received.

    Many thanks in advance

    David

Viewing 5 replies - 1 through 5 (of 5 total)
  • What is this code supposed to do? Did it already work on WP or did it have nothing to do with it?

    Thread Starter thestormdragon

    (@thestormdragon)

    Hi Varx

    It goes out to a weather website and grabs the local weather, tides info etc and turns the separate bits of info into a couple of paragraphs.

    It did work on WP but was missed in the site migration – and the old site is no longer in existence to check how it was setup.

    Cheers

    David

    Then someone needs to look at the code of your site and this code. This is the only way to understand how it was integrated.

    Also, what you have is all the code or just the base classes? You probably don’t have the functions that these classes run on pages.

    Thread Starter thestormdragon

    (@thestormdragon)

    Thx Varx – I was kinda hoping that integrating this code (which includes classes, private & public functions etc) would involve something simple (copying a file somewhere?) for further integration.

    I’ll find out if there are dollars available to engage a consultant programmer.

    Thx again

    Maybe it is. But without seeing the whole picture, nothing can be said. Sometimes, in such cases, it is easier to write the required functionality yourself “from scratch”. This can often take less time than picking at someone else’s code.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to extend page with custom PHP’ is closed to new replies.