Is there any way to access WordPress functions in CodeIgnighter? Basically I am running a website entirely using WordPress but I need to build a custom add-on system that needs to be separate from WordPress (so not a plugin). Thanks to this link
I can get WP functions working in views but not in controllers or models.
My folder structure is WordPress installed in site root then the CodeIgnighter in WordPress: root/wordpress/codeignighter
I need this as I want to use WordPress user functions so people can use the CI system with their WP accounts.
Turns out this was an error on my behalf I forgot to declare some global variables as the linked solution clearly states. My bad
Related
I'm trying to integrate Wordpress in CakePHP 2.6.1 to use it as a CMS for my end users.
I'm including the required file to access wordpress functions: wp-blog-header.php.
As CakePHP only allows to include files located inside CakePHP I placed the wordpress intallation inside app/Vendor/wordpress and now I'm trying to import the necesary file in my AppController in this way:
App::import('Vendor', 'wordpress'.DS.'wp-blog-header');
But it seems there's some functions conflict as I'm getting this error from CakePHP:
Error: Cannot redeclare __() (previously declared in /home/todopeta/alvarotrigo/pruebas/cakephp/lib/Cake/basics.php:581)
File: /home/todopeta/alvarotrigo/pruebas/cakephp/app/Vendor/wordpress/wp-includes/l10n.php
Line: 163
Has anybody integrated wordpress in CakePHP before?
What's the way to go for it?
I've seen it seems to be possible with other PHP MVC frameworksk such as Laravel.
Is CakePHP more restrictive in this respect?
Access the WP data by creating a WP plugin for CakePHP and add a model for each of the WP tables and read the data via CakePHP.
Your linked article does the same but it uses the WP_Query class and further down Corcel which seems to be a mix between the Eloquent ORM and WP. I would not go that path and use the CakePHP ORM.
I can guarantee you that everything else is going to become a pain in the rear thanks to the fugly WP code and architecture.
If you try to use the WP code inside CakePHP like you've tried this will become super painful, time consuming and probably never work right without some really really fugly code.
If you need only parts from WP consider creating a WP plugin and embedd the WP content via an iframe in your page. AFAIK WP got a json API as well these days, you could try to read the data via that API as well.
You're going to have a nightmare and end up with a massive mess of code with this approach.
Instead, why not try and use a CakePHP CMS system, for example:
https://croogo.org/
I am developing mobile application for existing magento website and the mobile application has its own web admin and web admin developed in core php (not in magento). Can we put the core php web admin code to magento /app/code/local/ folder ? and is it work with magento ?
Please help me on this.
We can consider Magento as an application that is constituted by modules. Each of this module does different functionalities, but still they are independent to each other. This property makes Magento highly extendable and powerful.
By default, Magento comes with lot of such individual modules. These modules are located inside app/code/core. Note that, this folder only holds Model and Controller logic parts. View logics are separated from this and it normally lies in app/design and skin folders.
If you need to extend Magento core functionality or if you need to add any new functionality, you have two options available.
Use an extension
Develop your own custom modules
For extension/pluggin, Magento uses app/code/community directory. This way core modules are seperated from extensions and it gives us lot of flexibility.
When you use your own modules to add any functionality, you probably need to add your module in app/code/local. This way, custom modules are seperated from both core and extensions.
When Magento looks for a module, it will first check that module in local directory. If it is not there, then it will check in community directory. If it is not there, again it will check in core directory. Finally it will check it in lib directory. This callback mechanism is the core concept that you need to understand , before start to develop your own extensions.
It is not necessary to put your custom module in app/code/local directory. You can put it in community or in core directory. This is because, the callback mechanism can pick up your module, irrespective of these three locations. However as I said earlier, three of this directories has its own purpose. So better use them properly as it demands.
Hope that makes lot of sense
From Magento Wiki,
Every custom module will be created in the directory:
/app/code/local
And this is the directory structure that you use to create one:
/app/code/local/<Namespace>/<Module>/
That way, we can have multiple modules under a single namespace.
Naresh, /app/code/local/ is used to put your custom developed plugin/extension for magento. it's main aim to have custom developed code and core code separate.
If in future you upgrade the version of magento than it overwrite/delete the code written in /app/code/core/ but leave the code as it is in /app/code/local/ and it's place where you can override the core block/helper/model as well.
you can't copy your code directly in to core, you have to create module/plugin to club your existing code with magento.
I'm sorry if my question is not good quality.I have problem when I want to understanding wordpress , I'm new in wordpress, and I want to create some module in wordpress, It's Possible?
ex.
if i want to add module, what must I'm studying in wordpress ?
Joomla usually refers to a module. Writing one in WordPress is considered a plugin. You should start studying the Codex and it will lay what you need to do out for you.
You can find that on the WordPress site at Writing_a_Plugin
WordPress Plugin: A WordPress Plugin is a program, or a set of one or more functions, written in the PHP scripting language, that adds a specific set of features or services to the WordPress weblog, which can be seamlessly integrated with the weblog using access points and methods provided by the WordPress Plugin Application Program Interface (API).
Wishing that WordPress had some new or modified functionality? The first thing to do is to search various WordPress Plugin repositories and sources to see if someone has already created a WordPress Plugin that suits your needs. If not, this article will guide you through the process of creating your own WordPress Plugins.
To develop WP plugins, you must familiar with wordpress hooks and API functions.
You can start learning/exploring from any existing plugins. I had started with "Hello_Dolly" :)
First off, this isn't really a programming question but more of a programming concept question. Basically, I've built a bespoke PHP framework to speed up deployment on my end and I want some kind of plugin system in place that will allow me to add specific features to the base of the framework (like the SQL class or maybe a Twitter package) that will allow me to throw them into a folder and not have to actually edit the base for every new project.
Any ideas of the best way of going about this?
Here is a nicely written post by #ircmaxell on how to do that and what are the options:
Handling Plugins In PHP
Also check out:
Best way to allow plugins for a PHP application
what im doing in my cms:
for each plugin i make a folder latin-named of this plugin's name.
i create a /translations folder in there too. Check here.
have a single php file that has 2 basic functions, the plugin_install and plugin_uninstall (you know, things to happen on install/unistall like tables creation/drop)
create a special page of your system that reads these plugins, installed and not and give an on/off switch so users can install/unistall them.
load these single files mentioned above by a single call to include_once on top of your index page (or administration page) so to include whatever functionality they offer.
enabled plugins will be loaded (include_once) from your main page, and also their functionality, so each plugin can call each other's as well.
I am working for a client right now that is wanting me to author a wordpress plugin for them, and on top of that they want me to integrate it into their template as a feature. However since the url of the location of the plugin could change I want to be able to call the loaded plugin from the template, however I am not finding any good way to do so. I have read over WordPress Codex and not found a function that suits what I need, or I simply don't understand what they are doing. I am not familiar with how WordPress loads and uses plugins. Thanks!
Here's the WP overview on plugins.
In short, plugins are managed by the WP install and once activated automatically load when the pages are called. Plugin files are stored in: wp-content/plugins/ and are stored within each individual WP installation. As long as your client doesn't mess with the wp-content directory structure, your plugin should load if activated in the WP admin console (and it's functional/doesn't break). This is the only way to run plugins through WP as of now (though I don't see this changing).
Wordpress has a built in function to find the path to your plugin, similar to this:
$pluginpath = plugin_dir_url(your_plugin.php);
I believe that is what you are asking, no? Or are you referring to sending a function from the plugin to the template? In that case, you have to use an action hook. Here is the reference: Link