This is a simple concept question... If I have a wordpress plugin and I want to write some functions for my own IN ADDITION to what they have already where would I put them in the wordpress file structure?
I cant put them in the original core.php files/directory because they will get wiped out when the plugins are updated right?
#NomikOS - Yeah Sure .. I have a wordpress plugin called BP-Phototag- pretty much an album..Its located in the wp-content/plugins folder. I want to add my own functions...for a specific template in my themes folder. DO i put the functions in the bpa.core.php file in the wp-conten/plugins folder or do I make a new php file that can inherit bpa.core.php functions(which I dont know how to do) and stick them in my template specific folder under wp-content/themes/mytheme folder. Im really not sure how to extend and override it...
If the plugin is class based, you can extend it to override/add methods. You can include the file containing your code inside plugin's directory if you want (it will not deleted after an upgrade) or directly inside plugins dir.
EDIT 1
Sorry, I didn't saw your last comment. Well, my friend, it's time to learn OOP PHP5. I recommend you PHP 5 objects, patterns, and practice. It's for PHP serious coders.
Basically you do
class leon_my_class extends BP_Phototag_class {
function __construct()
{
parent::__construct();
// my code
}
// overriding protected/public method
function BP_Phototag_method()
{
// this code will replace original code
}
// adding method
function my_own_method()
{
}
}
Related
I'm new to Symfony, but I believe I understand how routes and controllers work. I've played with the tutorials on their website and everything was going great. However, I am not able to do some (supposedly) very simple things and I can't find anything useful when googling. To be honest, I'm not even sure I'm using the proper terminology, which makes looking online difficult. Here's what I would like to do:
Use routes to point to files with HTML and display them. As I understand it, these files will be inside the public directory. What's the proper way to point to them from my controller class (see below).
e.g.:
class PageController
{
/**
* #Route("/")
*/
public function homepage()
{
return new Response('location of home.php');
}
}
Similarly, link to CSS and JS from within the HTML. That includes working with CSS frameworks such as Bulma - which is installed in node_modules, outside the public directory. How do I manage that?
In a project without Symfony, my links on the document head look like this:
href="img/favicon.png"
href="node_modules/bulma/css/bulma.css"
href="css/style.css"
How do I manage those now?
How do I apply what I already know about designing websites to Symfony?
normaly you need to return a file "twig", like for exemple: return $this->render('your_file_ruter/locationOfHome.html.twig')
I have a small problem with Shopware aplication. My point is, I create a new Theme which works perfectly, I can change any information at webpage using shopware backend profile, but when i copy the less files to my new repository folder, I cannot compile new theme. It stucks.
From the beginning,
Creating a theme using parent Responsive, all works perfect, theme compile.
Changing information on page, work perfect, theme compile.
Copy less files from Responsive/_public/less to newrepository/frontend/_public/less etc and it stucks.
Right now i dont have any idea how I am suppose to deal with it.
Any ideas ?
When a theme in shopware doesn't compile there is most probably something wrong with your less files. Have you copied all less files?
The path you mentioned is not correct.
syntax error in less files?
Did you copy the file Responsive/frontend/_public/src/less/all.less without copying the files that are imported in the all.less? Same applies for other files in this directory.
Whatever it is that is wrong with your less files. You shouldn't need to copy them from the parent theme. If you want to change something, just create your own files.
Say you want to have the background white. Create a file YOUR_THEME/frontend/_public/src/less/_modules/body.less with the content:
body {
background: #fff;
}
Then you are also going to need a file YOUR_THEME/frontend/_public/src/less/all.less with the content:
#import "_modules/body";
No need to copy or modify the original files.
Create a .css file here:
Responsive/frontend/_public/src/css/style.css
After that you should include the file in your Theme.php file like this:
protected $css = array('src/css/style.css');
under this function:
public function createConfig(Form\Container\TabContainer $container)
{
}
It worked for me. I have no idea how to include less files in a theme, they are usually added in a plugin by creating an event. I hope this helps.
Also Responsive Theme is default theme in Shopware. You should extend it and work on the newly created theme.
I guess it is obviously but are you following the Shopware strukture?
all.less (#import "modules";)
--_modules (#import "_modules/your";)
---your.less
?
Please don't copy all Less Files from the responsive theme. There are some mixins for the grid that stucks if you compile it twice, which is exactly the case if you copy all the files.
I've been asked to theme a site for a team (just a few hours they said), but they're using Grails with SpringSource tool Suite. I'm not familiar with either.
When I look at the "proper" source, the theme source files don't exist, yet they get served. If I search for the files in the IDE, I get some stuff in .path_to_grails_plugin directory (which is not in source control). If I edit THERE, it picks up my changes, but that doesn't help the team... and I want to point to a NEW theme, not mess up the original one. The Target directory has some of the files, but not all, but isn't that where generated content goes? So where is the REAL source? This feels like the dark arts to me. I am clearly missing some fundamental knowledge about how this works.
I want to add a custom theme (theme-roller-generated), so I created a sub-folder for it in my web-app folder. Then, in my config.groovy file I put:
grails.resources.modules = {
core {
dependsOn 'jquery-ui'
}
// Define reference to custom jQuery UI theme
overrides {
'jquery-theme' {
resource id: 'theme', url: '/css/theme-redo/jquery-ui-1.8.19.custom.css'
}
}
}
That doesn't do anything. It still serves the old css. Help me find the light!
The CSS is stored in the web-app\css and the JavaScript is in the web-app\js directories. However, I high recommend going through some tutorials before moving stuff around by trial and error. Good luck!
I've been running into the same problem. My workaround is to create another Resource module and include the theme there. It's an imperfect solution as the original unwanted theme css is still included - but it works.
ApplicationResources.groovy contains:
modules = {
application {
resource url:'js/application.js'
resource url:'/css/smoothness/jquery-ui-1.8.20.custom.css'
}
}
my.gsp contains:
<r:require modules="jquery, jquery-ui, application" />
ordering may be important..
I am trying to organize my theme folder, which has node theming overrides for dozens of views. Basically I have two different styles and I want them all to look the same, more or less.
Is there a way in template.php that I can do this? And what is the best way?
I tried this code in my theme's hook_preprocess_node function:
switch($vars['view']->name) {
case 'taxonomy_term' :
switch($vars['view']->current_display) {
case 'page' :
array_push($vars['template_files'], 'list-view');
default :
break;
}
break;
default :
break;
}
And when I look in theme developer, I can see the list-view.tpl.php file there, but its not actually using that file from my theme directory. What am I missing?
As you can see in theme() Drupal will only actually use a template if it exists according to drupal_discover_template().
You should try to figure out if that is the case.
place some debug code in the theme() function in includes/theme.inc to see what drupal_discover_template() returns for vairious template calls.
Can it find it?
If not:
place some debug code in drupal_discover_template() to find out where Drupal thinks it no longer is a template.
My gut-feeling says that it is due to subdirectories where the template files reside, but which you have not added to the template_files variable: views/lists/some_list.tpl.php is not the same as some_list.tpl.php.
You need to rebuild the cache for the tpl.php file to be picked up.
Is there a place where I can place override theme files other than a theme's folder? For example, if I wanted to override the appearance of a view's row in the same style for more than one theme without having to use more than one file.
If there isn't a generic way to do this (for any theme file), is there a way to do it for a view's theme files?
In your module, you can use hook_theme to declare a theme function or template for your view's row. This way, your single template will be used by all your themes without any special code in them. See the Theming your views in your module section in the Views's API Advanced Help page.
You could include an include_once type statement in your tpl.php file and just import the code from where ever. This way you have any number of files that refer to one.
It is not recommended though since if you move your theme folder or rename anything this can be harder. Also if you put your theme in another site you need to keep track of all of these off-theme hacks.
I think views seeks tpls inside of the theme folder. It's be nice to have something like that though.