mruz / base-app Goto Github PK
View Code? Open in Web Editor NEWThe base application in PhalconPHP
The base application in PhalconPHP
Hi,
I was trying to use bootstrap tabs with base-app but am unable to get even the basic thing working. The page I am using includes the below code. I copied it from a tutorial and pasted on a page where I was fetching data from table and showing. I have replaced all the old code with below just to see if tabs work but they don't. Kindly let me know what could be the issue and any solutions. Once it works I will replace fixed text with my table data. The tabs do show up but nothing happens when I click on them.
<div class="container">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab_a" data-toggle="tab">Tab A</a></li>
<li><a href="#tab_b" data-toggle="tab">Tab B</a></li>
<li><a href="#tab_c" data-toggle="tab">Tab C</a></li>
<li><a href="#tab_d" data-toggle="tab">Tab D</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane fade in active" id="tab_a">
<h4>Pane A</h4>
<p>Pane A text</p>
</div>
<div class="tab-pane fade" id="tab_b">
<h4>Pane B</h4>
<p>Pane B text</p>
</div>
<div class="tab-pane fade" id="tab_c">
<h4>Pane C</h4>
<p>Pane C text</p>
</div>
<div class="tab-pane fade" id="tab_d">
<h4>Pane D</h4>
<p>Pane D text</p>
</div>
</div><!-- tab content -->
</div><!-- end of container -->
Thanks
Amal
Hi,
Firstly, this is NOT an issue. I am trying to implement a left multi-level menu which will be generated from a database table. We should be able to close and expand it and it should be maximum 2-3 cols wide out of 12 (for whole screen). I found two references on the Internet but am not very sure how I can integrate that with base-app. If you can find time to help, that would be a big help. Here is what I found:
Create Multi-Level menu in Phalcon and Buildin tree menu in Phalcon
I got a left menu going but it is static and doesn't show up at all like what I want.
Thanks,
Amal
If i register new user I must activate it via email but I don't recive any emails...
Me config.ini
; Config.ini
;
; @package base-app
; @category Config
; @version 1.2
[site]
name = "LTest NAme"
url = "http://trickds.pl"
[database]
host = "localhost"
username = "root"
password = "pass"
dbname = "pass"
[app]
timezone = "Europe/London"
base_uri = "/"
static_uri = "/"
[auth]
hash_method = "sha256"
hash_key = "secret_key"
lifetime = 1209600
session_key = "auth_user"
session_roles = true
[session]
lifetime = 600
[cache]
lifetime = 3600
[crypt]
key = "secret_key"
[lang]
lang = "en-gb"
[email]
CharSet = "utf-8"
ContentType = "text/html"
Encoding = "8bit"
From = "[email protected]"
FromName = "Trick"
Mailer = "smtp"
Host = "smtp.gmail.com"
Port = 465
SMTPSecure = "tls"
SMTPAuth = true
Username = "[email protected]"
Password = "pass"
[log]
file = true
debug = true
It would be nice to see other adapters than model: collection, file.
first, nice work
wonder to now how to user form's on your base-app.
Good example could be use a form for sign-up and sign-in.
Thanks for your help
Hello,
I was trying to create some models and controllers for a new project using Phalcon DevTools but it gave errors. First it gave Error: Adapter was not found in the config. Please specify a config variable [database][adapter]
. I created the adapter
variable in db()
function in bootstrap.php. Now it is giving me Error: The builder is unable to find the views directory
when I try to run the below command:
phalcon scaffold --table-name=ro_relorder_t --get-set --template-engine=volt
I think there is no variable modelsDir
as given in the basic config.php
file provided by Phalcon. Kindly let me know where do I specify all these directory settings.
Amal
I would like to use the same app/frontend/views/index.volt template in other modules e.g. app/module2/ How can I do this?
When I log in and I want go to te "Account" tab I see error "Error! Please log in to access.". User have login and admin role added in sql.
Hi,
A basic question, how come Users
model has no properties like username, password, email
etc. This code was working till now but doesn't seem to work anymore. I don't understand. The code on line 124-126 has:
$this->username = $this->request->getPost('username');
$this->password = $this->getDI()->getShared('auth')->hash($this->request->getPost('password'));
$this->email = $this->request->getPost('email');
but there is no username, password, email
in the model. How was it working? Am I missing something.
I have another related question, how come $this->request->getPost
works in a model, this should work only in a controller, right. The request
object is null when I execute the code now.
Thanks
Amal
Be able to translate validation messages at one place, phalcon/cphalcon#767
Please add utf-8 to db connection in bootstrap.php
protected function db()
{
$config = $this->_config;
$this->_di->set('db', function() use ($config) {
return new \Phalcon\Db\Adapter\Pdo\Mysql(array(
"host" => $config->database->host,
"username" => $config->database->username,
"password" => $config->database->password,
"dbname" => $config->database->dbname,
"options" => array(
\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'
)
));
});
}
I don't known what it mean $config->app->env == "development" in function app/boostrap.php
public static function log($messages)
{
$config = \Phalcon\DI::getDefault()->getShared('config');
if ($config->app->env == "development") {
foreach ($messages as $key => $message) {
echo Debug::dump($message, $key);
}
exit();
} else {
In the public/index.php we use function \Baseapp\Bootstrap::exception($e); and it has $config->app->env == "development"
Hello,
I created a directory "forms" in .\app\frontend
. Created a form in it called CompanyForm, created a corresponding directory in frontend\views
called company. Created scripts for index, create \ edit \ search
. How do I specify formsDir
in base-app and how do I use forms with it.
Thanks
Amal
Hi,
I am using the latest version now, although the site works but I keep getting the following errors in my PHP error log. Is there any way to remove it. Its a single error.
PHP Notice: Undefined variable: siteLangs in C:\Wamp\www\myapp\app\common\cache\volt\app\frontend\views\index.phtml on line 73
...
PHP Warning: Invalid argument supplied for foreach() in C:\Wamp\www\myapp\app\common\cache\volt\app\frontend\views\index.phtml on line 73
Thanks
Amal
How about creations basic controller for backend and carrying out of logic of authorization in it?
When i generate error in production environment i get error
Fatal error: Class 'Phalcon\Debug\Dump' not found
in base-app\app\Bootstrap.php on line 466
I use Phalcon 1.3.2 and Phalcon\Debug\Dump class from incubator and not included in base-app
Hi,
I created a form called PropertyForm in "forms" directory inside frontend directory. I also created a directory called "property" under views. I created index.volt and search.volt inside this directory. Is that the correct way to go about using forms with your base. Created a property table and corresponding model. Created "public" and "private" templates in the views/layouts directory. Most of this is similar to how sample app Vokuro is organized. I wanted to know if this is ok. I hope I can use forms with your base-app.
I do get an error in frontend/views/index.volt:
Undefined variable: i18n in C:\Wamp\www\myapp\app\common\cache\volt\app\frontend\views\index.phtml on line 3
If I comment out that line it gives me another error:
Undefined variable: auth in C:\Wamp\www\myapp\app\common\cache\volt\app\frontend\views\index.phtml on line 27
What is it that I am doing incorrectly.
Thanks, Amal
Hello,
I have set cacheDir as below in config.ini but it has no effect. The cache is still created in the default directory on the local disk, i.e. ROOT_PATH"/app/common/cache/".
[cacheBackendFile]
adapter = "File"
options[cacheDir] = "R:/temp/"
;options[cacheDir] = ROOT_PATH"/app/common/cache/"
It used to work if I used the default Phalcon code and use the below line in config.php
'cacheDir' => 'R:/Temp/',
...
After few days I again have problem with user login when i want login me php give this error: PHP Fatal error: Cannot use the memory manager when the request is shutting down in Unknown on line 0
In php.ini i have memory_limit = 512M
How i can get content from another controller in volt template?
I find function request in bootstrap, but how i can use it, i dont undestand.
Help me please.
Hello,
I am using Phalcon 2.0.8. If I try to use base-app with it, gives errors:
PHP Fatal error: Declaration of Baseapp\Frontend\Module::registerAutoloaders() must be compatible with Phalcon\Mvc\ModuleDefinitionInterface::registerAutoloaders(Phalcon\DiInterface $dependencyInjector = NULL) in C:\Wamp\www\base-app2\app\frontend\Module.php on line 13
I think you need to change a few lines in Module.php and other places registerAutoloaders() / registerServices()
are used to make it compatible to Phalcon 2.x. Saw the below solution on another post.
public function registerAutoloaders(\Phalcon\DiInterface $dependencyInjector = NULL) { //..... }
public function registerServices(\Phalcon\DiInterface $dependencyInjector = NULL) { //........... }
Amal
How to add admin user or change role?
If I just registred > confirm email > and change in sql role id form 1 to 2 then when I want to log in, got this error: "Incorrect password" but why?
Email getTemplate from Library doesn't return view's content:
$email = new \Baseapp\Library\Email();
$output = $email->getTemplate('activation', array('username' => 'mruz', 'hash' => 'test'));
echo \Baseapp\Library\Debug::vars($output);
Hi.
How i use the base-app like a library in my project ?
For example: to use the Auth class in my project.
Thanks.
Hello,
I have a minor problem which is probably not an issue but I couldn't solve it. I am new to Phalcon. I setup base-app on my Win 7 64bit machine running 64bit Wampserver. The pages display without any style. When I check Console (using inspect element) in Firefox, it shows me the following:
The stylesheet http://mruz.pl/base-app/css/bootstrap.min.css was not loaded because its MIME type, "text/html", is not "text/css". fdm_brcache.js:86
The stylesheet http://mruz.pl/base-app/min/css/fonts.css was not loaded because its MIME type, "text/html", is not "text/css". fdm_brcache.js:86
The stylesheet http://mruz.pl/base-app/min/css/app.css was not loaded because its MIME type, "text/html", is not "text/css". fdm_brcache.js:86
SyntaxError: syntax error jquery.min.js:1
SyntaxError: syntax error bootstrap.min.js:1
SyntaxError: syntax error flashclose.js:1
How do I solve this. I searched but couldn't find any solutions. The CSS files mentioned are already available locally, is the application still using them from your site.
If its not a problem can I have your email id.
Thanks
Amal
Have just installed WAMP 2.5 after clean install of win 7. Had wamp 2.2e before. Now I get this error "Phalcon\Assets\Exception: Non-free csssminifier not available". Ca't think what it is. Am I missing a dependency or something?
Hi, in first, thank you for your hard work with phalcon.
I'm receiving this error after signup:
Fatal error: Class 'Phalcon\Debug\Dump' not found in /app/Bootstrap.php on line 470
In other hand, $logger->log($message); appears have two params, $type is missing.
Hello,
I wanted to request you to add the facility to log SQL statements in your framework. See this:
https://docs.phalconphp.com/en/latest/reference/models.html#logging-low-level-sql-statements
I have this in my Base App based config.ini
[app]
name = "base-app"
...
enableDebugging = 1
enableDblogging = 0
Or we can use just Debug
& DBLog
.
Kindly also provide Debugging
boolean for code. We can place our echos, var_dump, \Phalcon\Debug\Dump
calls in if (enableDebugging) { ...
Thanks
Amal
Hi,
I want two NAV bars fixed at the top. One containing the menu, another one the sub-menu. I want the footer bar fixed which I have been able to do modifying index.volt:
<footer class="navbar navbar-default navbar-fixed-bottom">
I also want a left fixed column (menu bar), unable to get it working exactly the way I want but this is secondary. Can you help with two top NAV bars first. I have tried a lot of combinations, read a lot of posts on StackOverflow etc but doesn't seem to work. It would be great if you can help. Here is what all I have tried for the 2nd bar:
<nav class="navbar navbar-default navbar-lower affix" role="navigation">
If I understand correctly base-app uses Bootstrap 3, correct me if I am wrong. Here are some links which I used:
http://stackoverflow.com/questions/21616381/multiple-fixed-top-navbar-headers-in-twitter-bootstrap-3 - I used this post, its css & js files
http://stackoverflow.com/questions/18944282/multiple-navbars-on-the-same-page-with-twitters-bootstrap-3
If I use a <div class="divide-nav">
between the two NAVs then my sub-menu appears below the top one otherwise it hides behind the top nav. I have seen code working with pure bootstrap but it doesn't seem to work in phalcon environment.
Thanks for your help in advance.
Amal
Function $email->prepare(bootstrap.php) dont work when generating error in production environment. And Email::getTemplate contain 2 return;
Error trace
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.