I'm using the asset library that comes with pyrocms for my cms and I have a set up like this for my assets. I am trying to figure out with the paths and namespacing how I can access the bootstrap.css file correctly with the documentation.
http://docs.pyrocms.com/2.1/manual/developers/tools/assets
I have updated my asset.php configuration file to look like this:
$config['asset_paths'] = array(
'core' => 'assets/',
'globals' => 'assets/globals/'
);
This is the line I have set up in my template page to try and retrieve the bootstrap file:
<?php Asset::css('globals::bootstrap/css/bootstrap.min.css'); ?>
This is my file directory:
/root
/assets
/globals
/bootstrap
/css
bootstrap.css
It is saying the following error message.
Found no files matching
assets/globals/css/bootstrap/css/bootstrap.min.css
Any ideas on what I good fix would be for this?
I've never used the library in question, but judging on your post it appears that the library automatically checks for a css folder within the designated asset_path.
I would create a new asset path called bootstrap:
'bootstrap' => 'assets/globals/bootstrap/'
and add the CSS file as such:
Asset::css('bootstrap::bootstrap.min.css');
Related
I wrote a small app using laravel 5.2. I tried to keep all of my code in one folder located outside the app folder.
I created a folder called modules. Inside the modules folder I have a folder for vendor name. Then, inside the vendor folder, I have a module folder which contains my code.
Here is a simple folder structure
app modules/vendor name/module name/...
I managed to move my controllers, views and a route file into the module name folder.
How would I move all of the javascripts located in the public folder into my module name folder so that everything inside is in the same folder?
Additionally, I have a lot of questions about the views being in the module folder. Is it a better practice to use $this->publishes() to publish views to the resources/views folder that comes with laravel? If so what are the benefits?
https://laravel.com/docs/5.2/packages
The benefit to publishing the views is that the end user, should they want/need to, then has the option to modify the views.
As for the javascript, its completely fine to contain the javascript in your modules folders as the docs mention. You have 2 options as to how they're then used. You can either choose to publish them which moves them into the public folder, or you can include them in your build process if you use elixir/gulp, etc. See https://laravel.com/docs/5.2/packages#public-assets
Edit:
To publish assets such as javascript files (they could in theory be anything, be that images, css, etc.) use the following from your packages service provider.
public function boot()
{
$this->publishes([
__DIR__ . '/path/to/script.js' => public_path('vendor/my-package'),
__DIR___ . '/path/to/another.js' => public_path('vendor/my-package'),
]);
}
The above will move both script.js and another.js into the /public/vendor/my-package folder. Just to explain __DIR__ is a PHP 'magic' constant which gives the directory the current php file is located in and public_path() is a Laravel function which gives us the location of the /public folder as some users choose to rename this folder to their specific configuration.
I am creating a module called "Web" in magento 1.7.2. Folder structure is like app/code/local/Company/Web/ then Block, controllers, Model, etc, Helper. Again under controllers creating Adminhtml folder and IndexController.php file. Under Adminhtml folder ProductController.php file is there. I have another one file which is in my root folder called reader.php file. I want to include that file in my ProductController.php file. But unable to do so. I have tried by the following code:
$basePath = Mage::getRoot();
include($basePath.'/reader.php');
Please help me how to include the file.
Thanks in advance.
Mage::getRoot() gives you the app folder. You should use Mage::getBaseDir() instead. That will give you your absolute base dir.
In cakephp how can I access a file, inside vendor folder?
I am not using app folder. I have created another project folder with same structure of app.
Should I use the same
App::import('Vendor','phpseclib0.3.6/Net/SSH2.php');
statement or anything else.
Vendors libs should follow some name conventions. For libs with custom names us the following:
App::import(
'Vendor',
'aUniqueIdentifier',
array('file' => 'phpseclib0.3.6/Net/SSH2.php')
);
And read section Loading Vendor Files
I've noticed some people mentioning a similar request for controllers and sometimes models, but I've been unable to find anything on arranging plugins in subfolders.
I want...
/app
/Plugin
/Modules
/Form
/Controller
/Gallery
/Controller
/SomeStandardPlugin
/Controller
..so that I can keep all the CMS functionality specific plugins separate.
I've tried:
CakePlugin::load('Form');
CakePlugin::load('Modules/Form');
CakePlugin::load('../Plugin/Modules/Form');
No matter which of the above I try, when I attempt to make use of the controller in one of the plugins, it says:
Error: FormsController could not be found.
Error: Create the class FormsController below in file: app\Controller\FormsController.php
(Which would be fine if I didn't want it in a plugin!)
The CookBook didn't mention anything about it either - is it just not supported or am I missing something?
FYI: I'm using CakePHP v2.2.3
The argument for CakePlugin::load is not a path
The first argument for this function, is the name of a plugin. This is the correct way to load a plugin:
CakePlugin::load('Name');
But it will only work if the plugin exists in a location configured using App::build
As such, to organize plugins into subfolders, it's necessary to declare all paths that contain a plugin:
// append app/Plugin/Modules to the path to look for plugins
App::build(array(
'Plugin' => array(
APP . 'Plugin/Modules'
)
));
I have been trying to implement twitter bootstrap extension in Yii but cannot do it.
I am following the guide below to install it with Yii.
http://www.cniska.net/yii-bootstrap/setup.html
I copied and pasted the following code in my main config file as described in above guide.
// Define a path alias for the Bootstrap extension as it's used internally.
// In this example we assume that you unzipped the extension under protected/extensions.
Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');
return array(
'theme'=>'bootstrap', // requires you to copy the theme under your themes directory
'modules'=>array(
'gii'=>array(
'generatorPaths'=>array(
'bootstrap.gii',
),
),
),
'components'=>array(
'bootstrap'=>array(
'class'=>'bootstrap.components.Bootstrap',
),
),
);
Can anyone please help.
Found the answer you need to put the following in your main.php file of your protected/views/layouts folder anywhere between <head> and </head> tag.
<?php Yii::app()->bootstrap->registerAllCss(); ?>
It worked for me like a piece of cake. I guess problem with you is your path to bootstrap extension. I would suggest to put complete path instead of relative path. Once it get working you can try to make the path relative.
Example:
Yii::setPathOfAlias('bootstrap', '/var/www/yoursite/application/extensions/bootstrap');
Instead of:
Yii::setPathOfAlias('bootstrap', dirname(FILE).'/../extensions/bootstrap');
This should work for you! Cheers!!!
I am also use that but the answer is not come but I got another way so you follow that I tell.
I think you want new themes so"
Go to download themes from yii framework.
Copy that folder then past to themes folder
config->main.php->'theme'=>'grey-stripes', protected go config folder go main.php go and copy 'theme'=>'grey-stripes',
Your new themes are ready