I'm trying to get evert's sitemap-php library working in CodeIgniter using the vague instructions that I found in another StackOverflow post, but I'm not having any success. I've got a few questions that should be enough to point me in the right direction when answered:
Should the makeSitemap() function be added to the default controller?
If evert's Sitemap.php file is placed in the libraries folder (instead of nested in the SitemapPHP folder like the example), can it be loaded properly using the standard CI syntax?
$this->load->library('sitemap');
Where does the sitemap folder belong?
I'd greatly appreciate any insight on these questions. Unless someone beats me to it, I'll be sure to post a code-based solution once I get this working.
You can do it on two ways. First would be modifying Sitemap.php code including property (i.e. $CI) and getting codeigniter's object by reference in constructor as described in documentation. However second way would be using composer autoloader and IMHO that should be your prefered way. In this answer I described how to use github repository in CI application but there is more answers and articles that can point you in right direction how to use composer in CI.
If you go with first way, you would call $this->sitemap->method() and if you would go with second method, you would use library as described on github's readme section.
Related
I am currently working on site built by another developer on CodeIgniter. I do not have the GitHub repository since there is no way to reach the previous developer. All I have now is the project files stored in the file system of the host. I found the view folder of the project and see a bunch of PHP files on it. The codes of each PHP files look similar, I am having trouble knowing which PHP files generate which page.
My question is, on the browser, is there a way to know which PHP files generate the HTML of the page that I am currently viewing?
In CodeIgniter, Controllers are the routes generally. Look in the controllers directory. For example User controller with update method will result in /user/update route. Moreover, the developer might have specified custom routes too. You will have to check application/config/routes.php too. Once you will locate the correct controllers, you can find the views used by the related controllers (or routes). I hope this helps.
You cannot use the "view" files to quickly figure out what URL displays that file. It's entirely possible that any given "view" file is used on multiple pages. It's also quite likely that any given URL will use multiple "view" files.
You should instead examine the files under /application/controllers and look for lines of code making a call to $this->load->view('some_file_name_here'); There may or may not be a subdirectory as part of the file name - depends on how the original dev organized things.
The CodeIgniter documentation is excellent and is found HERE. Start with the General Topics. In particular, the following general topics (in the order shown) may be highly useful and help you make sense of what the other answers are talking about.
Controllers
Views
CodeIgniter URLs
URI Routing
Models
A read-through of the tutorial will be helpful too after checking out the above.
Use the Libraries section of the docs to get details on the various parts of the framework you're likely to run into in your explorations.
I am looking to implement Angular2 inside my current Laravel project. I've read about many setups including AngularClass's version with Webpack, but I feel like it's all over-complicated.
What I wish to make:
A simple single page app inside my Laravel app.
It needs to have something like Grunt/Gulp or even Webpack to compile upon changes.
Does not need NodeJs to run in production, no lite-server, just like AngularJS it can be injected and that's it.
I need to understand the implementation files to achieve this, so no starterpack or angular-cli, unless if you can supply good arguments.
Looking for a "how to"-like example on creating the above.
Thanks in advance.
EDIT: More information
As ANKH pointed out, i needed a more detailed and coursed question. So here we go:
- Looking for a example implementation of a Angular2 based SPA inside an existing PHP application (Laravel).
- I've tried many different tutorials, going from the heroes tour, to Sitepoint and AngularCLI based tutorials, but they all assume a SPA on it's own. Ergo, they are compiled and served through NodeJS, which I don't need.
Turns out that I've actually been looking at this entirely wrong. I've gone with using Angular-cli and found that I could generate the output files and include these inside my Laravel project. No need to integrate them further.
Adding Httpful (http://phphttpclient.com/) to ATK4 using the recommended Composer method does not work.
After some fooling around I managed to get all the file paths correct but I get "Fatal error: Class 'Frontend' not found in /var/www/portal/index.php on line 14".
Using the 'phar' method described on Httpful's page is also a no-go.
I don't know if this needs to be implemented through an add-on, and if it does, I don't know how. Any info/pointers would be appreciated...
The bottom line is: I need to interact with a REST API in a sane way, it doesn't have to be Httpful specifically, is there another solution out there that someone has already implemented in ATK4?
Please look into this repository which is designed to run Agile Toolkit based on composer primarily:
https://github.com/atk4/atk4-secure/
You can also look at this branch:
https://github.com/atk4/atk4/tree/4.3-PageManager-refactoring
which deals with this issue:
https://github.com/atk4/atk4/issues/403
although that's not part of the "master" branch, instead it went to 4.3. Perhaps you can back-port the commits.
Edit: I must also mention, that this should work best if you have picked Agile Toolkit from Git repository.
I use YII framework and I needed to echo out query that is generated with the method insert($attributes=null) in CActiveModel class which, as it's told in documentation, is in framework/db/ar/CActiveRecord.php.
Well, my task was not hard, so I opened this file and edited this method, but nothing happened. After a little head-ache I've found out that my application was importing this class from the folder where I downloaded YII first.
What could be the reason of this behavior? I've solved my problem by changing path but I wonder, is it good solution?
Thank you in advance.
It's on index.php where you tell your application where to find the classes of the framework, so that's the line you should edit.
// change the following paths if necessary
$yii=dirname(__FILE__).'/../yii/framework/yii.php';
I'm trying to implement Symfony2 form builder component as a standalone. The documentation
doesn't really talk about this though, just in relation to using the whole framework.
The standalone is on Github but has no docs.
Ive searched around and seen a few people ask this question but none seems to have any answers.
All I need is a basic guide on how to setup a form , build it, then view it.
Anyone?
Edit: My first response below is now obsolete (and the link does not work anymore). Please refer to
https://github.com/webmozart/standalone-forms for a state-of-the-art solution.
Previous (now obsolete) answer:
I've tried hard and managed to display a form (using PHP engine, not Twig).
Indeed you need a few components: Form, but also ClassLoader, EventDispatcher, Templating (for rendering) and Translation (for rendering labels). You will also need some resources from the FrameworkBundle bundle (mainly templates).
More info on this:
http://forum.symfony-project.org/viewtopic.php?f=23&t=36412
And my mini-tutorial:
http://n.clavaud.free.fr/blog/index.php?article31/symfony2-standalone-form-component-tutorial
First, copy Form Component to your project to directory which contains third-party libraries (not only Symfony components, but also ORM or whatever), let's say lib/, so it's in <project_path>/lib/Symfony/Component/Forms.
Then you have to auoload it - either manually or using any PSR-0 compatible class loader i.e. SplClassLoader or Symfony's UniversalClassLoader (there is chapter in docs and in quick tour about this). Example:
$loader = new UniversalClassLoader();
$loader->registerNamespace('Symfony', __DIR__.'/lib');
$loader->register();
Using Form Component isn't in fact strongly documented, but in Symfony Book there are few examples how to use Form classes about this component, so I guess you'll have to dive into sources, beginning with Form class (maybe later you'll give some feedback about experiences somewhere in the Web?).
Since Symfony 2.1, the form component has been using composer.
You can locate the composer.json file inside the repository. It contains a dependency map that can be used to get the dependencies installed.
You can do so by simply running composer install from inside your console.
P.S I know this thread is old. The information I'm contributing apply to any new users that may need it.
First of all not with Symfony2. But creating form with Aura.Input and some view helpers of Aura.View makes it easy to bring Standalone Forms and Validation.
If you are interested you can read it over http://harikt.com/phpform/ , and source is in github.
/*
* This file is part of the Symfony package.....
what i understand from that line is that the file is a PART of the framework, can't be removed, can't be ripped, and it won't function if you rip it off the package because it requires other related files in the framework
however, there is an option, and it is to investigate the files and see what functions they call and what variables they use ,redefine them, and use it as standalone IF the license allows you to