I try to get into mysite/user so that application/classes/controller/user.php should be working, now this is my file tree:
alt text http://img704.imageshack.us/img704/5338/bugiz.png
code of controller/user.php:
<?php defined('SYSPATH') OR die('No direct access allowed.');
class Controller_User extends Controller_Default
{
public $template = 'user';
function action_index()
{
//$view = View::factory('user');
//$view->render(TRUE);
$this->template->message = 'hello, world!';
}
}
?>
code of controller/default.php:
<?php defined('SYSPATH') OR die('No direct access allowed.');
class Controller_default extends Controller_Template
{
}
bootstrap.php:
<?php defined('SYSPATH') or die('No direct script access.');
//-- Environment setup --------------------------------------------------------
/**
* Set the default time zone.
*
* #see http://kohanaframework.org/guide/using.configuration
* #see http://php.net/timezones
*/
date_default_timezone_set('America/Chicago');
/**
* Set the default locale.
*
* #see http://kohanaframework.org/guide/using.configuration
* #see http://php.net/setlocale
*/
setlocale(LC_ALL, 'en_US.utf-8');
/**
* Enable the Kohana auto-loader.
*
* #see http://kohanaframework.org/guide/using.autoloading
* #see http://php.net/spl_autoload_register
*/
spl_autoload_register(array('Kohana', 'auto_load'));
/**
* Enable the Kohana auto-loader for unserialization.
*
* #see http://php.net/spl_autoload_call
* #see http://php.net/manual/var.configuration.php#unserialize-callback-func
*/
ini_set('unserialize_callback_func', 'spl_autoload_call');
//-- Configuration and initialization -----------------------------------------
/**
* Initialize Kohana, setting the default options.
*
* The following options are available:
*
* - string base_url path, and optionally domain, of your application NULL
* - string index_file name of your index file, usually "index.php" index.php
* - string charset internal character set used for input and output utf-8
* - string cache_dir set the internal cache directory APPPATH/cache
* - boolean errors enable or disable error handling TRUE
* - boolean profile enable or disable internal profiling TRUE
* - boolean caching enable or disable internal caching FALSE
*/
Kohana::init(array(
'base_url' => '/mysite/',
'index_file' => FALSE,
));
/**
* Attach the file write to logging. Multiple writers are supported.
*/
Kohana::$log->attach(new Kohana_Log_File(APPPATH.'logs'));
/**
* Attach a file reader to config. Multiple readers are supported.
*/
Kohana::$config->attach(new Kohana_Config_File);
/**
* Enable modules. Modules are referenced by a relative or absolute path.
*/
Kohana::modules(array(
'auth' => MODPATH.'auth', // Basic authentication
'cache' => MODPATH.'cache', // Caching with multiple backends
'codebench' => MODPATH.'codebench', // Benchmarking tool
'database' => MODPATH.'database', // Database access
'image' => MODPATH.'image', // Image manipulation
'orm' => MODPATH.'orm', // Object Relationship Mapping
'pagination' => MODPATH.'pagination', // Paging of results
'userguide' => MODPATH.'userguide', // User guide and API documentation
));
/**
* Set the routes. Each route must have a minimum of a name, a URI and a set of
* defaults for the URI.
*/
Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'welcome',
'action' => 'index',
));
/**
* Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
* If no source is specified, the URI will be automatically detected.
*/
echo Request::instance()
->execute()
->send_headers()
->response;
?>
.htaccess:
RewriteEngine On
RewriteBase /mysite/
RewriteRule ^(application|modules|system) - [F,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
Trying to go to http://localhost/ makes the "hello world" page, from the welcome.php
Trying to go to http://localhost/mysite/user give me this:
The requested URL /mysite/user was not found on this server.
SOLVED
Apache did not have access to the directory, permission change and presto.
Set your RewriteBase to / instead of /mysite/ and try accesing localhost/user
Related
I want to get openapi specs from comments.
I have been using express-jsdoc-swagger to get the specs.
Is there any other way to do it?
I got extension where I have to take "comments"(files might be js,ts and so on) like this ->
/**
* GET /documents
* #summary Get all documents
* #tags Document
* #param {string} project_id.query
* #security BearerAuth
* #return {object} 200 - success response - application/json
* #example response - 200 - success response example
* {
* "results": [
* {
* "project_id": "",
* "document_html": "",
* }
* ],
* }
* #return {object} 400 - Bad request response
*/
and get the openapi specs.
I just wanna know If there are any other ways to do it, because there are some problems
why I can't use express-jsdoc-swagger.
I thought this would be shown in the docs but I'm trying to get column resizing working with Tabulator.
This page just describes how to import the plugin:
import {ResizeTableModule} from 'tabulator-tables';
But what do you with this import? I thought you could add it to Tabulator.extendModule(ResizeTableModule) but that does nothing. I couldn't find any examples using plugins modularly like this. Thanks for the help.
To get column resizing working, you can import ResizeColumnsModule as follows:
import { Tabulator, ResizeColumnsModule } from "tabulator-tables";
Tabulator.registerModule(ResizeColumnsModule)
Example: https://codesandbox.io/s/gifted-wescoff-nw337l?file=/src/index.js
As per docs correct way to extend a module is like
/**
* #param {String} moduleName
* #param {any} configs
* #param {any} newconfig
*/
Tabulator.extendModule("resizeTable", "config", {
//Your New Config
name: "__int__",
});
I am afriad as ResizeTableModule module does not expose any other config but you can define them by extending the class
import { Tabulator, ResizeColumnsModule, ResizeTableModule } from "tabulator-tables";
class MyResizeTableModule extends ResizeTableModule {
constructor(table) {
super(table);
this.config = MyResizeTableModule.config;
}
}
MyResizeTableModule.config = {};
Tabulator.registerModule([MyResizeTableModule, ResizeColumnsModule]);
/**
* #param {String} moduleName
* #param {any} configs
* #param {any} newconfig
*/
Tabulator.extendModule("resizeTable", "config", {
//Your New Config
name: "__int__",
});
See Codesandbox
I am using Codeigniter Version 4.1.7.
Where I am implementing Rest API.
In the routes the GET method works,however Post method is not working.
I am testing this using POSTMAN.
URL : http://localhost/myproject/api/add-user
Following is the header
Accept: application/json
Content-Type: application/json
Authorization: Basic xxxxxxxxxxx=
Please check the code below for reference.
Routes.php
$routes->setDefaultNamespace('App\Controllers');
$routes->setDefaultController('Home');
$routes->setDefaultMethod('index');
$routes->setTranslateURIDashes(false);
$routes->set404Override();
$routes->setAutoRoute(false);
/*
* --------------------------------------------------------------------
* Route Definitions
* --------------------------------------------------------------------
*/
// We get a performance increase by specifying the default
// route since we don't have to scan directories.
//$routes->get('/', 'Home::index');
$routes->group("api", ["namespace" => "App\Controllers\Api", "filter" => "basicauth"] , function($routes){
$routes->get("list-users", "ApiController::index");
$routes->post("add-user", "ApiController::create");
});
ApiController.php
app\Controllers\Api\ApiController.php
<?php
namespace App\Controllers\Api;
use CodeIgniter\RESTful\ResourceController;
use App\Models\UsersModel;
class ApiController extends ResourceController
{
/**
* Return an array of resource objects, themselves in array format
*
* #return mixed
*/
public function index()
{
//
$users = new UsersModel();
$response = [
'status' => 200,
"error" => false,
'messages' => 'User list API',
'data' => $users->findAll()
];
return $this->respondCreated($response);
}
/**
* Create a new resource object, from "posted" parameters
*
* #return mixed
*/
public function create()
{
//
$rules = [
'first_name' => 'required|min_length[3]|max_length[20]',
'last_name' => 'required|min_length[3]|max_length[20]',
'email' => 'required|min_length[6]|max_length[50]|valid_email|is_unique[users.email]',
'password' => 'required|min_length[8]|max_length[255]',
'password_confirm' => 'matches[password]',
];
...
...
...
return $this->respondCreated($response);
}
}
Any help would be appreciated.
I'm using i18next to handle translations, with i18next-node-fs-backend, to load translations from a filepath. My i18n.init() function looks like this:
i18next.use(i18nextBackend)
.init({
lng: 'en',
ns: ['module1, module2],
backend: {
loadPath: rootFolder + '/node_modules/{{ns}}/locales/{{lng}}.json',
}
}...
What i want to do is load all translations from that loadPath AND also load the translations from another file, located in another path, like rootFolder + '/locales/{{lng}}.json', like passing to path to loadPath parameter
loadPath: [rootFolder + '/node_modules/{{ns}}/locales/{{lng}}.json', rootFolder + '/locales/{{lng}}.json']
Is it possible to do that? Any suggestions?
Thanks.!
/**
* Utility function to determine loadpath for a given language and namespace
* this allows us to separate local files by namespace which makes it easier to
* find translations and manage them.
*
* #param {*} lng the language locale
* #param {*} namespace the namespace name as specified in the i18n 'ns' config
*/
function loadPath(lng, namespace) {
// console.log('loadPath', lng, namespace);
let path = `/locales/common/${lng}/translation.json`;
/**
* Add additional case stmts for new locale sub directories.
* This allows for splitting up translation files into namespaces, namespace can
* then be attached to a specific component or accessed through notation.
*/
switch (namespace[0]) {
case 'common':
path = `/locales/common/${lng}/translation.json`;
break;
case 'container':
path = `/locales/container/${lng}/translation.json`;
break;
default:
break;
}
// console.log('loadPath', path);
return path;
}
then in i18n.js configuration
i18n
.use(Backend) // load translation using xhr -> see /public/locales
.init({
// i18next-xhr-backend config for loading files from different locations
backend: {
loadPath: loadPath,
},
});
Greeting everyone !
I have a problem - snippets not works.
In Theme.php I use next
/**
* #param Form\Container\TabContainer $container
*/
public function createConfig(Form\Container\TabContainer $container)
{
$container->addTab($this->createBasicTab());
}
/**
* Create Basic Tab
* #return Form\Container\Tab
*/
public function createBasicTab()
{
$tab = $this->createTab(
'basic_settings',
'__basic_settings__',
[
'attributes' => [
'layout' => 'anchor',
'autoScroll' => true,
'padding' => '0',
],
]
);
In snippet located in _private/snippets/backend/config.ini I used next
[en_GB]
basic_settings = 'Basic settings'
[de_DE]
basic_settings = 'Basic settings de'
And in admin part I got next
Please, help!(
You can use it like this:
Shopware()->Snippets()->getNamespace('backend/config')->('__basic_settings__', 'There you can put value by deault')
Documentation for snippets.
In theme manager we have checkbox force snippet reload in settings. Please, enable it. This will save your nerves