I have developed the CRM based web application what i need to do is to integrate the wordpres with my CI first i have the problem when i include the main WP file
require('./wp-blog-header.php');
in my one of the CI view file the error i was getting that function site_url() conflicts this function is the base function of both WP and CI ,although i found a solution to include the WP file in the main index.php file of CI but there is uncertainity too that after this the session library of CI stops working is.
How to show the posts of WP in the footer of my CRM?
When using include or require in my CodeIgniter views I make sure the files I am linking to are outside of the CodeIgniter application folder as I had trouble using files there because of some permission problems. My solution was to just keep a folder in my web directory. You also cannot use base_url or site_url CodeIgniter functions here since you want to get the server path not the web address of the file. So you can use the php variable $_SERVER['DOCUMENT_ROOT'] which will return the root of your web directory.
It might look something like this:
require($_SERVER['DOCUMENT_ROOT'].'wp-blog-header.php');
Which would work if wp-blog-header.php was in your web root directory.
Related
I have ci installed in root and wordpress inside wordpress directory.
I already allowed wordpress to use root by setting site url and main .htaccess to rewrite wordpress directory, but because ci is inside root i have url conflict between ci and wordpress..
You know that ci using pretty links, so when i try to run this for example:
example.com/ci_class/ci_function
It's redirects me to wordpress template with message
Not Found
This happens probably because i included wordpress wp-load.php inside index.php of codeignitier...
What i can to do?
I want to use wordpress functions inside ci, but i also want that ci url works fine...
I have just installed the Yii2 Basic Application Template using Composer.
This is now accessible on my localhost machine at the following URL:
http://localhost/basic/web
In Yii 1.1, it was possible to access a web application by simply going to :
http://localhost/basic
Having done some reading, it appears the only way to achieve the above is to create a new Apache vhosts entry. Whilst this is fine for one or two sites, if like myself you are working on new sites all the time, it is a bid tedious to have to set up vhosts for each and every site.
I have tried creating a .htaccess file to redirect all requests to web/index.php but this does not work. Is this at all possible to do in Yii2?
Move all the content in the /basic folder to eg. /basic-yii instead. Then take the /basic/web folder (now /basic-yii/web) and put all it's content into the /basic folder. Then adjust the paths for the require() calls in /basic/index.php to correctly point to autoload.php, Yii.php and web.php.
I was loading view in CodeIgniter as
$this->load->view('../../myfolder/footer');
It was working fine on windows machine. I have uploaded app to linux machine and start getting error
Unable to load the requested file: ../../myfolder/header.php
myfolder is in CI application folder.
How can i load view from application/myfolder
Please help me and thank you in advance.
Why you need tho load views in application/myfolder?? Code Igniter expects that views are located in application/views or application/views/myfolder. Put your files in application/views and then you can load it using:
this->load->view('footer');
or
this->load->view('myfolder/footer');
If it worked on Windows but no longer works on Unix, it could be because the filepaths are case sensitive in Unix.
Check the file structure and file names to make sure they match the CodeIgniter requests exactly.
E.g.:
$this->load->view('../../myfolder/footer');
Will fail trying to load:
../../MyFolder/footer
../../myfolder/Footer
../../MyFolder/Footer
etc
$this->load->view(base_url().'myfolder/footer');
That should work but I have no idea why you're trying to work outside the views folder to begin with. Just structure your views folder like below. Load the header, footer and anything else that's static from a template page.
Views
--pages
--admin
--templates
--etc.
hi i have a web application installed in a remote server i wanted to modify this web application so i downloaded all the files from the server
.zfproject
library folder
application folder
public_html folder
and i created a folder called newZend in my local xampp\htdocs folder
when i tried to access the website
"http://localhost/newZend/public"
it gives me an application error saying
script 'login/index.phtml' not found in path (C:/xampp/htdocs/newZend/application/modules/user/views\scripts/)
i believe something might be wrong with the url router or base path..please help
The standard Zend Framework .htaccess rules and routes will take the url you gave
when i tried to access the website "http://localhost/newZend/public"
and call for the "index" action of the "public" controller.
None of my Zend apps allow access directly to the public directory. Try this url:
http://localhost/newZend
which will call the index action of the index controller.
On my local setup I have a load of different CakePHP websites. I'm using a Mac so the folder structure is something like ~/Users/cameron/Sites/sample-website and then within each of these websites I will have the typical Cake folder and App folder.
What I would like to do is have just a core cake folder and then have ALL the sites pull from that one cake core so I don't have the same stuff several times over. I have been reading some tutorials on the web: http://rickguyer.com/cakephp-one-core-many-apps/
So I have my cake folder here: ~/Users/cameron/Sites/cake-1.3/ and then my site here: ~/Users/cameron/Sites/sample-site/ and in this folder I have the usual app folder and htaccess to tell it where to find webroot etc.
Now I have edited the index.php file inside webroot like the tutorial BUT have only changed one line because I haven't moved my files OUTSIDE of the App folder like he does. So the only like I have changed is as follows:
if (!defined('CAKE_CORE_INCLUDE_PATH'))
{
define('CAKE_CORE_INCLUDE_PATH', '..'.DS.'..'.DS.'cake-1.3');
}
As far as I can tell that is correctly looking two directories up and finding a folder called cake-1.3 however it just gives a error 500?
Any ideas what the problem is? Thanks
EDIT:
Even doing this doesn't work???
Which If I echo: echo CAKE_CORE_INCLUDE_PATH; gives /Users/cameron/Sites/cake-1.3 and if I paste that in the address bar it loads up the cake folder so it's definitely the correct folder structure JUST it doesn't like looking at cake outside of the main url?
if (!defined('CAKE_CORE_INCLUDE_PATH'))
{
define('CAKE_CORE_INCLUDE_PATH', DS.'Users'.DS.'cameron'.DS.'Sites'.DS.'cake-1.3'); echo CAKE_CORE_INCLUDE_PATH;
}
You are right on the money with:
define('CAKE_CORE_INCLUDE_PATH', DS.'Users'.DS.'cameron'.DS.'Sites'.DS.'cake-1.3');
Just make sure that Users sits in root. In other words, when you go to terminal you can get to this directory by typing: cd /Users/cameron/Sites/cake-1.3
It looks like you may be on a MAC. If so, your linking is correct. Most of the time what I find is you have done a copy paste of the app directory and it does not get the .htaccess files. I would check those first. But here is a comprehensive list of what you should verify:
Make sure the host is pointing to
the correct directory
(/Users/cameron/Sites/sample-site/)
Verify mod_rewrite is in fact on.
Verify you have copied the .htaccess
file in both the
/Users/cameron/Sites/sample-site/
and the
/Users/cameron/Sites/sample-site/webroot
directories.
Confirm that the
/Users/cameron/Sites/cake-1.3/
directory has a directory called
cake in it that contains the core.
Once all of this is confirmed, you will be good as gold!
Happy Coding!
UPDATE:
When the index.php file looks for the cake core, it will look for a directory inside the location you are pointing to for another directory called cake. So in your case:
define('CAKE_CORE_INCLUDE_PATH', DS.'Users'.DS.'cameron'.DS.'Sites'.DS.'cake-1.3');
You must have the cake directory inside /Users/cameron/Sites/cake-1.3. Your directory structure will look like:
/Users/cameron/Sites/cake-1.3/cake
/Users/cameron/Sites/cake-1.3/cake/libs
/Users/cameron/Sites/cake-1.3/cake/config
/Users/cameron/Sites/cake-1.3/cake/console
etc.
CakePHP 3.0+
In CakePHP 3.0+ this configuration is moved out of webroot/index.php to App/Config/paths.php
If you have access to your php.ini, you can add the path to Cake core there. Doing it this way means you don't have to change webroot/index.php at all. Example in php.ini:
include_path = ".:/usr/local/lib/php:/home/something/phpinc/cakephp2/lib"
According to the CakePHP 2.x docs, this is the recommended way to share the Cake core (assuming you have access to your php.ini).
You can have only one cake core but you must have one app folder (containing MVC) by site.
Is this a misunderstanding of the folder structure of CakePHP?
From the docs (CakePHP folder structure):
The app folder will be where you work your magic: it’s where your application’s files will be placed.
The cake folder is where we’ve worked our magic. Make a personal commitment not to edit files in this folder. We can’t help you if you’ve modified the core.
So the cake folder shouldn't change between all of your uses, therefore you have 1 copy. You can always change some of the functionality of the core by making your own changes in the app folder i.e. extending.
There is no need to edit index.php.
Just put an alias (or link in UNIX) to your cake folder in each of your sites folder. Works perfectly. Same goes for plugins and vendors folder.