This is prolly a stupid question but I am experimenting with Flask-User. I see the venv/.../flask_user/user_manager__settings.py file and see
USER_LOGIN_URL = '/user/sign-in' #:
I do not see a method for this though. Something is rendering a view for the sign-in page but I am not seeing the connection. What part am I missing?
Edit
What am I asking? I have copied the flask-user templates from site-packages into my test. I have slightly tweaked them. However, when I click the default Signin link I get an untweaked login template. I am wondering if something has a hardwired template path? I am just not finding that url->view->template linkage.
There are config options to change the templates, for example:
USER_LOGIN_TEMPLATE = 'your/path'`
Found here: https://flask-user.readthedocs.io/en/latest/configuring_settings.html
Related
This page: /my-account/view-order/132616/
... is associated with the view-order.php template file under the my account section. I am able to edit this by going directly into the woocommerce plugin dir, but copying the file into /my-child-theme/woocommerce/myaccount/view-order.php does not have any effect. I am able to edit the orders.php template in this manner, but not this one. I haven't been able to find any answers online to this one: why some of these template files can be copied / overwritten and some cannot be? Also, there appears to be limited scope on applying a hook to manipulate the content on this page. What I want to do, is turn the product names listed here into links back to the products in the store. Thanks for any help!
turns out this doesn't satisfy my need since the content I'm trying to manipulate is in the woocommerce_view_order do_action. Now I'm on the hunt for a filter hook.
I am currently working on a new website with TYPO3 and now I am facing a big problem with template/cache.
Environment:
Extension "Portfolio" adds a new content element with Extbase/Fluid-Template. The template contains only the sentence "Create custom template" because I don´t want to provide a default template.
Extension "Layout A" contains the main template for the website, as well as the template for "Portfolio".
Cases:
When I am logged in as admin always the correct template is used.
When I am logged out and make "Clear all cache" in install tool the first page I load afterwards gets the correct template. The second/third/... page uses the first and wrong template.
Settings:
"config.no_cache = 0" is disabled
TYPO3 6.2.2
RealURL enabled
I added a TypoScript Text-Object with the template path to my fluid template and printed it in fronted. Always the path of the correct, second template.
Does anybody have an idea what´s the problem?
Thanks in advance!
Best regards
Boris
Install Tool Clearcache will clear the extbase cahe, so maybe the tempalte paths might be lost.
You should set the path to the templates explicitly via:
plugin.portfolio.view {
layoutRootPath = {$path}
partialRootPath = {$path}
templateRootPath = {$path}
}
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
... ok ... so ... i just needed to "clear cache" after all that. i thought because i don't have caching on (site is in development) i wouldn't need to clear it. wrong.
the solution was:
add the file node--my-content-type.tpl.php and go to Administration » Configuration » Development then click the clear cache button.
i hope this helps someone not spend hours on end solving this same problem!
Using Drupal 7.2, I have created a custom content type 'my_custom_type and I can't for the life of me figure out how to create a custom template for my custom type. My template file at the moment just prints "hello world", but no luck displaying it. I've tried these combos of things:
putting node--my-custom-type.tpl.php in the my theme's templates directory. That didn't work. So I, after researching, added this to my THEME_preprocess_page() function in templates.php:
if (isset($variables['node'])) {
$variables['template_files'][] = 'node--'.
str_replace('_',
'-',
$variables['node']->type);
}
putting that same code in THEME_preprocess_node() without the if, so:
$variables['template_files'][] = 'node--'.
str_replace('_',
'-',
$variables['node']->type);
both of the above but with my tpl.php file in the base template directory: /modules/node/
Any help would be tremendously appreciated. I'm at a complete loss.
Also, I added print "what the what" in /modules/node/node.tpl.php and it printed.. maybe this is because the content-type isn't a node? but then how to create a default template for a content type?
It's not advisable to modify core files. See http://drupal.org/best-practices/do-not-hack-core. I'm not sure if this is what you're doing, but if you are...
What you should do instead is create a subtheme. See guides at http://drupal.org/node/225125 and http://drupal.org/node/171194
Usually you would put your custom theme files in /sites/all/themes/custom/subtheme_name/ node--my-custom-type.tpl.php.
Remember to clear your cache at http://yoursite.com/admin/config/development/performance so that your new template files are recognized.
If you want to avoid having to clear your cache all the time, you can install http://drupal.org/project/devel and choose to rebuild the theme registry on every request.
Be sure to turn it off before your site goes live, as leaving it enabled incurs a huge performance it.
Is there a way to set a website like google.com as homepage through C++ or C ? How ?
Not sure what your motive is, but I don't think of this as something I want any code on my system to be setting out from under me. It sounds like the kind of thing adware/malware would do to your grandparents (who wouldn't know how to fix it once it's set). Note the negative comments when the question was asked of how to do it from JavaScript:
How can I set default homepage in FF and Chrome via javascript?
It's better to point people at instructions for doing it themselves. Remind with a banner which says "Make us your homepage!", and link to something along these lines:
http://www.makeuseof.com/tag/how-to-change-your-homepage-in-5-browsers/
If not for the aesthetic reasons, there are technical reasons not to try and write code for it. Each browser stores this information in its own place. In IE's case, there appears to be a registry setting:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Start Page
So you'd use calls to the Windows Registry API to query it and set it. But Firefox doesn't save this in the registry, it saves it in something called prefs.js and you'll be looking for:
user_pref("browser.startup.homepage", .... );
Then there's Opera, Safari, Chrome, etc. All told, better to just give people directions and put them in control of their experience!
Imports Microsft.Win32
...
Module Util
Sub SetHomePage(Dim theUrl As String)
Registry.SetValue("HKCU\Software\Microsoft\Internet Explorer\Main", "Start Page", theUrl)
End Sub
End Module
Yes.
Find the way each browser saves its configuration to disk and edit that (*). It may be a file, or records in a database, or some data in a central registry, or some other scheme --- the browser documentation should tell you.
To open/read/write/save/close a file, the C functions declared in the header <stdio.h> may be helpful.
(*) for Firefox it's a file named "prefs.ini" in a directory somewhere under the users home path; there may be more than 1 such file if the user has more than 1 profile.