Laravel Admin Directory - admin

I am trying to separate my admin code from my public code, I want to create 2 different directories in my app folder and resources folder, 1 directory named backend which contains all my admin code and another named frontend which contains public related code.
Each directory will have their own separate controllers.
Basically something like this:
-App
--frontend
--backend
-resources
--views
---frontend
---backend.
If there is a better way to do this i would also like to know.

By default you composer.json is autoload all in app. So you can make the structure which you described above.
Frontend and backend separating usually used for Controllers, in this case you need to make a correct namespace.
With views you would'n have any porblems. Just make a correct path when you calling your views.
For example:
view(frontend/index); // you can use dot instead of /

Related

Bitrix component and module customisation

I am working with Bitrix24. I want to customise the component and module of Bitrix24.
But I didn't have the standard documentation for this.
Some one help me for the same,how we can work with local folder for customise component and module etc.
If you need to change logic of component you may do through this way:
create the local folder in your documet_root path
create components folder in the local folder
create bitrix folder in the components folder
copy component folder from /bitrix/components/bitrix to
/local/components/bitrix
edit logic in the component.php file (or in class.php file if
component using new bitrix core - D7) in the copied folder
If you need to change only the view, this is another way:
Instead of creating the /local/components/bitrix you have to
create /local/templates/.default/ folder
Copy there only the .default template of a needed component
Edit template.php file
With the second way, you also may change (or rich it) some data in final $arResult array provided for the template.php, just create result_modifier.php file in the template directory.
You can find this and other information in the free course Bitrix Framework, pay attention to this link, it will be very helpful

Where to get Settings for a Yesod Subsite from?

The yesod scaffolding provides Settings.Extra which can be used to configure the master site. But in the case of subsites like gitit2 this can't be used, can it?
Is there any way to put the subsites configuration in the main config/settings.yml or should one use a separate yaml file, e.g. config/gitit2.yml. How can I easily reuse Yesods config machinery in the latter case?
You could define a settings type in the subsite that has a FromJSON instance, and then include that inside the config/settings.yml file. Then just include a value of that subsite settings type in your Extra data type and things should fall out correctly.

How to create directory structure

I am not quite sure if my directory structure has the correct hierarchy and I decided to stop the development unless I will have it good.
I have order, customers, users .
So what I have is:
myproj
|-myproj
|-web_app
|---orders (with views.py, ajax.py)
|----templatetags
|---users
|---customers
|---search
|---static
|-----app
|-------_base
|---------css
|---------images
|---------js
|-------orders
|---------css
|---------images
|---------js
|-------customers
|---------css
|---------images
|---------js
|-------users
|---------css
|---------images
|---------js
|-----bootbox
|-----bootstrap
|-------css
|-------fonts
|-------js
|-----dajax
|---templates
models.py is in web_app directory, there are models common for all modules. My questions are:
1) What changes would you do in this structure? (static files for every module should be where?)
2) I have problem of inserting custom template tag defined in orders/templatetags/orders_extras.py from users template. How can I make some common templatetags for every "module" ?
Thank you.
This is explained in Django documentation very well. The good approach is:
Project
- App1
(Put app specfic templates to the app templates/App1/templates/App1/template files
- App2
- App3
- template for project (templates/ files)
Now, if you want template tags only for specific app create /templatetag directory under that app and do that.
For universal template tag do this:
Project
- templatetags
- __init__.py (Make sure it contains __init__.py)
- polltag.py
Explained here: https://docs.djangoproject.com/en/dev/howto/custom-template-tags/
How can I make some common templatetags for every "module" ?
You should place it near the templates directory
myproj
|-myproj
|-web_app
|---templates
|---templatetags
|---orders (with views.py, ajax.py)
|----static
|-----static_files_here
dajax
Is this about dajax? If you are new to django, I recommend to get away from this stuff. You can just watch the issues list of this project to decide whether you should use it or not. The problem not only about that dajax is bad or good, but that these issues are being made by newbies that don't understand how ajax works, what are csrf tokens and so on.
When I started to learn django, I tried dajax too, but finally I have realized that you should understand how ajax and django works by their own and then try to combine them.

templating system with zf2?

we are planing to create a CMS with zf2 and doctrine orm .
actually we are concern about our cms templating
we want our system works with several templates and easily change between themes via admin
and creating a new templates should be easy for end-users developers
we want an advice or suggest for how to build templating system that :
there is a core module and there a lot sub modules with their own phtml
so where to store theme1 phtml and where to store theme2 phtmls ...
any suggest or advice please
thanks
I encourage you to take a look at Twig, its the best template engine I have seen so far :) It does take some time to learn Twig syntax, but its well worthy if you look at what you get :)
I cant yet write comments, so I wrote this as an answare.
Hope this helps. Trust me, the Twig is the way to go. Joust look at his documentation for more specific details how to use it!
EDIT:
The problem you are trying to solve has nothing to do with template engine. You can do that with any template engine. You can do it even with plain PHP if you want.
I built web application where users can register, get their own sub domain, and there they can build their webpage. Change theme, edit text, add pages. Simple CMS functionality.
The easiest way to do this is to have themes folder, where you would store themes, like this:
themes/
- themeBlue
- css/
- images/
- js/
- html or views/
- themeRose
...
Now this is where you would place all your themes, every theme has its own folder with images, css, js files...
And then you would have users, and every user would be able to choose and change theme.
That information would be stored in database. You need to store that user Jack is using themeBlue. You can do that as you want. You can event put this in users table like user_theme column.
Now when someone visits site, you first query database to see what theme is that user or creator of web using. And then you load all that files from current theme folder. And populate html files with data stored in database like in any other CMS.
This is the simplest implementation. You could for example, store css and html files in database :)
Hope this answers your question.
Good luck with that, I almost gone mad building my system :) I ended up with writing my own PHP MVC Framework joust to accomplish what I wanted.
if you activate another module in the application.config.php which has the same views and layouts (same folder structure and filenames) it's viewscripts and layouts will automatically be used when it's loaded after your core module.
so you could simply make your application.config.php dynamic to load the active template module which only contains the view folder. this would be a simple and effective solution without any other libraries.
additionally you can use an asset manager like assetic to also provide images, css etc. inside of your (template-)modules. (have a look at zf2-assetic-module, I wrote my own assetize-module based on assetic to fit my needs...)
Sina,
I do this in my Application->Module.php onBootstrap
$ss = $serviceManager->get('application_settings_service');
$settings = $ss->loadSettings();
$serviceManager->get('translator');
$templatePathResolver = $serviceManager->get('Zend\View\Resolver\TemplatePathStack');
$templatePathResolver->setPaths(array(__DIR__ . '/view/'.$settings['theme'])); // here is your skin name
$viewModel = $application->getMvcEvent()->getViewModel();
$viewModel->themeurl = 'theme/'.$settings['theme'].'/';
In this situation I have this structure in my view folder
view/
default/
application/
error/
layout/
zfcuser/
red/
application/
error/
layout/
zfcuser/
The $viewmodel above injects a variable into the layout for the themeurl in the public_html folder /theme/red/ with all assets for red
Access in layout.phtml -> themeurl;?> in a viewscript layout()->themeurl;?>
I am still working out my Dynamic Views. Right now I have a BaseController and all my ActionControllers extend it. It has a render() function that builds the required views but not sure its going to be scalable hoping to try some placeholder ideas.
application_settings_service is a Settings Service that gets settings for whatever domain was used to call the system and builds an array accessible via any service aware part of the site. Thats a whole different post and it may or may not rub MVC peeps the wrong way
I know your question is marked answered just thought I would share
Eric

Joomla: Using the same override in two different templates

I am working with Joomla 1.5 and using two different templates. To customise the frontend, I am overriding components and modules in /template/myTemplate/html/componentOrModule/. In a few cases I need the same overide in both templates.
Until now, I am using include to reuse the code. But it is still annoying, that I have to create the folders and files twice.
I reckon, that there is a better/easier way of doing it. But I do not have clue.
Did someone have the same problem and has already solved it? Any ideas appreciated.
There is no Joomla solution to this issue. My proposal would be to have a stub file in your template html folder and then include that file from a third folder. Something like the following:
/templates//html/com_content/article/default.php
You can copy that file into all the relevant override folders and then have one folder in the templates folder named "common" where you have the actual files with the output.