How to run Zend Project module...?
This is my project folder structure.
VIEW at $APP_DIR/application/modules/catalog/views/scripts/item/display.phtml.
CONTROLLER at $APP_DIR/application/modules/catalog/controllers/ItemController.php
BOOTSTRAP at $APP_DIR/application/Bootstrap.php
LAYOUT at $APP_DIR/application/layouts/master.phtml
FORM at $APP_DIR/library/Square/Form/Contact.php
AND LANGUAGE FILE at $APP_DIR/languages/messages.fr.php:
Please what URL should I enter in browser URL section to run this project...
I want to run ItemController...
Please help me...
By default you URL would look like http://your_domain/catalog/item/display or, maybe, like http://your_domain/fr/catalog/item/display
if your project is set up correctly you access a module like this:
example.com/module/controller/action
note: take a look at this blog on how to set-up a modular ZF application:
http://www.amazium.com/blog/create-modular-application-with-zend
Related
I'm trying to create a messages.pot file for my application using the workflow described in the docs. Unfortunately, I can't get this to work. I can render the cached version of my templates, but when running xgettext, no strings are recognized.
After inspecting a cached template, I see calls being made to
echo $this->env->getExtension('translator')->getTranslator()->trans("Yadda", array(), "messages");
I guess xgettext only looks for calls to gettext(), dcgettext(), etc. Am I missing something here? How to fix this?
I'm using Silex 2.0.3-dev, twig 1.24.1, twig-bridge 3.0.7.
i had the same problem... i found no way to get it by the translator component, so i wrote and node js script to parse the twig files...
here is the pastebin link... if u like to update the file or something please contact me probably we can put it on github...
http://pastebin.com/WSDsABfz
I have a website being developed using Laravel 4 by a freelance dev. While the developer has developed the site with some standard URL's for each page, I want to be able to change the words in URL to suite each of my target markets.
For example, developer made URL of one page: www.site.com/public/city/vehicles
Later, i want to be able to change to www.site.com/Rome/Cars or www.site.com/Sydney/bikes
However the developer says it wont be possible later on to change URLs as this is limitation in Laravel. Can anyone please shed some light on this and how to do this?
Why it is not possible ?? URL can me made dynamic if you want . Using route as
Route::get('/city/{slug}/{slug}',array('as'=>'city.vehciles','uses'=>'yourcontroller#yourmethod'));
This will output :
www.site.com/city/Rome/Cars
//if public folder is removed from url .
//Here `Rome` and `cars` are dynamic and the value comes as per the slug value from database.
In the above route slug are the thing that can me made dynamic . Just keep some place to add slug while adding vehicle in your dashboard from where you add vehicles.
Also, if you want to explore more then please see this doc .
Hope you get it .
You can remove "/public/" from your Laravel 4 website path by editing your Apache2 configuration files.
This file can be in different places (depending on your server setup), but it should be easily findable. E.g. for AWS EC2 (Ubuntu 14.04) it's /etc/apache2/sites-available/000-default.conf
You want to place this snippet within that configuration file:
DocumentRoot /var/www/YOUR_PATH/public
<Directory "/var/www/YOUR_PATH/public">
AllowOverride ALL
</Directory>
Remember to call service apache2 restart so your server recognizes and serves this update.
Also, depending on how your developer built your website, you might need to update your Laravel routing file too.
For reference it should look something like this (app/Http/routes.php):
Route::get('ajax/support/{city}/{vehicle}', 'MyController#MyMethod');
Then you'd have a matching method like so (app/Http/Controllers/MyController.php):
class MyController extends Controller
{
public function MyMethod(Request $request, $city, $vehicle)
{
// You can access $city and $vehicle here.
}
}
I have worked through the examples in the documentation for the Fat Free Framework, and there is one example that I cannot get to work. It is the following:
$f3=require('lib/base.php');
$f3->route('GET /',
function($f3) {
$f3->set('name','world');
$template=new Template;
echo $template->render('template.htm');
// Above lines can be written as:
// echo Template::instance()->render('template.htm');
}
);
$f3->run();
I receive an error that the Template is not found. The error points to the line in which the template.htm file is being rendered and complains of Preview->render (i.e. its superclass, instead of Template->render). I don't even see a file for a Preview class in the codebase.
Interestingly, if I use the same file for the View example (below), it works just fine.
$f3=require('lib/base.php');
$f3->route('GET /',
function($f3) {
$f3->set('name','world');
$view=new View;
echo $view->render('template.htm');
// Previous two lines can be shortened to:
// echo View::instance()->render('template.htm');
}
);
$f3->run();
However, if I am going to use this framework, I would like to be able to utilize its templating feature as well.
Does anyone with experience with this framework have any idea what could be the problem? I downloaded the code from Github (https://github.com/bcosca/fatfree).
By default F3 uses the same folder where is located your main file (where you start the framework instance). You can change this behavior by setting a new path for the UI parameter. In short:
$f3 = \Base::instance();
$f3->set('UI', path_to_your_templates);
let's say you have the following structure:
- app
-- views
--- template.htm (your template)
- public
-- index.php (where your init the framework)
-- (template files are expected here by default)
public/index.php looks like:
$f3 = \Base::instance();
$f3->set('UI', __DIR__.'/../app/views/');
$f3->route('GET /',
function($f3) {
echo Template::instance()->render('template.htm');
}
Hope it helps.
Use .html instead of .htm. Yep, it really matters.
I have no experience using fat free framework, but a general pointer on how to debug this issue.
Apparently the file not found exception is being thrown by some code inside fat free framework. Try debugging that using XDebug
I ran across this issue with version Fat Free Framework 3.5.1
The issue appears since the framework OOB (in at least this version) is wired with a sample such that the templates are looked for in the 'ui/' subfolder of the root fat free framework folder.
What tells me that? Well... the OOB config.ini has the following contents:
[globals]
DEBUG=3
UI=ui/
To easily solve the problem either:
Put the file 'template.htm' in the 'ui/' subfolder
OR
Rename the 'ui/' subfolder to whatever you like in the config.ini and put the 'template.htm' file in that location
TIP: Make sure whatever UI path you specify ends in a / and if you need to specify multiple paths you can use the | or , or ; separators (making sure each path ends in a /)
What are some popular ways (and their caveats) of handling dependency path changes in scripted languages that will need to occur when deploying to a different directory structure?
Let the build tool do a textual replace? (such as an Ant replace?)
Say for example the src path in a HTML tag would need to change, maybe also a AJAX path in a javascript file and an include in a PHP file.
Update
I've pretty much sorted out what I need.
The only problem left is the URL that gets posted to via AJAX. At the moment this URL is in a JS config file amongst many other parameters. It is however the only parameter that changes between development, QA and production.
Unfortunately dynamically generated URLs as #prodigitalson suggested aren't desirable here--I have to support multiple server side technologies and it would get messy.
At the moment I'm leaning towards putting the URL parameter into its own JS file, deploying a different version of it for each of development, QA and production, additionally concatenating to the main config file when deployed.
IMO if you need to do this then youe developed in the wrong way. All of this shoul dbe managed in configuration file(s). On th ephp side you should have some kin dof helper that ouputs the path based on the config value... for example:
<?php echo image_tag('myimage.jpg', array('alt'=>'My Image')); ?>
<?php echo echo javascript_include('myscript.js'); ?>
In both these cases the function would look up the path to the javascript and image directories based on deployment.
For links you should be bale to generate a link based on the local install of the application and a set of parameters like:
<?php echo link_to('/user/profile', array('user_id' => 7)); // output a tag ?>
<?php echo url('/user/profile', array('user_id'=>7)); // jsut get the url ?>
As far as javascript goes you shouldnt have any paths hardcoded in a js file that need to be changed. You should make your ajax or things that are path dependent accept parameters and then you send these parameters from the view where you have the ability to use the same scripted configuration.. so oyu might have something like:
<script type="text/javascript">
siteNamespace.callAjax(
'<?php echo url('/user/profile/like', array('user_id' => 7)); ?>',
{'other': 'option'}
);
</script>
This way you can change all this in a central location based on any number of variables. Most MVC frameworks are going to do something like this though the code will look a bit different and the configuration options will vary.
I would take a look at Zend Framework MVC - specifcally the Config, Router, and View Helpers, or Symfony 1.4 and its Config, Routing and Asset and Url Helpers for example implementations.
I'm working on a Symfony project and I am seeing this in a view.yml file. What is the meaning of it:
javascript:
- js/jquery.min.js
I can see that this sentence loads the library but, what the difference between that and this:
javascript: [js/jquery.min.js]
Also, I have other problem: When I want load another component, it does not load the jquery library; why is that?
It's a way to do lists in YAML, for example in an app I have:
profileViewSuccess:
javascripts:
- /jquery-ui/js/jquery-ui-1.8.7.custom.min.js
- /js/jquery.periodicalupdater.js
- /js/jgrowl/jquery.jgrowl.js
- /js/jquery-uniform/jquery.uniform.js
- /js/lightbox.js
- /js/profile.view.js
- http://maps.google.com/maps/api/js?sensor=false
This looks nicer than:
profileViewSuccess:
javascripts: [/jquery-ui/js/jquery-ui-1.8.7.custom.min.js, /js/jquery.periodicalupdater.js, /js/jgrowl/jquery.jgrowl.js]
etc. etc. with all the other files.
Did you cleared cache running "symfony cc"? When you change a configuration file you must run such command to apply the changes.
Hope this helps. On the other hand your english is pretty hard to understand XD I'm spanish as well but I think spanish is not allowed here.