lundi 30 mars 2015

Problems with PHP if statment

I have been trying to setup a plugin using php. The php file just registers the plugin. The problem is that there are some image files that I want to include in the plugin but the plugin is not picking it up.. I do not get any error messages, its just that when the plugin is installed I do not see the image files, I actully do not know php this is just one file i need to compile for larger project.



<?php

class Plugin_Theme extends DPlugin
{

public function init()
{
DTheme::register($this, $this->getMeta('theme1', 'theme1'));
DTheme::register($this, $this->getMeta('theme2', 'theme2'));
DTheme::register($this, $this->getMeta('theme3', 'theme3'));
DTheme::register($this, $this->getMeta('theme4', 'theme4'));
}

private function getMeta($sub_id, $sub_name, $extends = 'default')
{
$meta = array (
'id' => 'maintheme-' . $sub_id,
'title' => 'maintheme-' . $sub_name,
'extends' => $extends,
);
if ($sub_id != 'theme1') {
$meta['assets'] = array(
0 => 'image1.jpg',
1 => 'image1.jpg',);
}
if ($sub_id != 'theme2') {
$meta['assets'] = array(
0 =>'image2.jpg',
1 =>'image2.jpg',);
}
if ($sub_id != 'theme3') {
$meta['assets'] = array(
0 => 'image3.jpg',
1 => 'image3.jpg',);
}
if ($sub_id != 'theme4') {
$meta['assets'] = array(
0 => 'image4.jpg',
1 => 'image4.jpg',);
}

return $meta;
}
}

Aucun commentaire:

Enregistrer un commentaire