Hello Processwire-Community,
i just wanted to greet you because i think its a better way to introduce myself.
I didnt found a better Thread to do this, so i think im not wrong to post this here. If i missed the specific Thread, then dont mind moving my ass there.
First of all, im German. Im 19 years old, very young and i have no idea how i found processwire. Maybe its because other CMS-Systems seems a little bit too packed for creating my stuff. If i wanna program something, i want to know why i writed this and where my mistakes are. Only then i can improve in this matter. So, with this in mind, i picked Pw, because most user say it gives a wide freedom to do stuff you wanna do.
I already started with my project, but there re some questions rolling in my head, so i wanna ask them here. If you have knowledge about it, i would appreciate it if you could give me an answer. If not, post some random bbcode-spam under this thread and think of something joyful .
1. Processwire gives the option to create pages and so on. Its useful, yes, but what if i wanna display only the content of a .php-file over the URL and place it in my template? So that i dont need to write my whole template for every .php-file that i include?
2. And while we are at it: how does the parent- and child-system work with the URL? If i, say, make an "foreach" for every link i have posted in a database-table called "navigation_links" and now get the ROOT-path + this link, how can i tell processwire to accept it? If use use it like this:
and try to use it, it says to me "404 not found", but i just navigate it to the .php file i have created in my folder.
3. @ryan: i have read your post about the login-example here: https://processwire.com/talk/topic/107-custom-login/ .
if i wanna use this as an external .php-file, it works. But i wanna use it as an component on my site. For this, there is a little problem:
First of all, if i click on the Login-button, it does nothing. The Page stays where it is and doesnt redirect me to a page called "login_successful.php".
Second, if i watch in the database the session_throttle, it lets me stay in the attempts and the date. So the Informations didnt get transmitted. Here is the Code, i would appreciate it if you could give me help with this. Maybe im missing something. Please remember im just testing the functions. I will change it until i have my results.:
/templates/login.php (Makes decisions if a User is LoggedIn or not and includes the file i need)
<?php
if($user->isLoggedin()) {
include("loggedin_form.php");
} else {
include("login_form.php");
}
?>
/templates/login_form.php (Gives a Form to write username and password and transmit it)
<!-- This Form gives an login-form to login or register to the site-->
<?php
if($input->post->user && $input->post->pass) {
$user = $sanitizer->username($input->post->user);
$pass = $input->post->pass;
if($session->login($user, $pass)) {
$session->redirect("login_successful.php");
} else {
$session->redirect("login_unsuccessful.php");
}
}
?>
<div id="login_form">
<?php if($input->post->user) echo "<h2 class='error'>Login failed</h2>"; ?>
<form action='./' method='post'></form>
<input type='text' value="Username" name='user' />
<input type='password' value="password" name='pass' />
<input type='submit' name='submit' value='Login' /></p>
</div>
Register will follow later, i will use another table for that.
4. If i wanna use an function-library, which folder-structure is identical to my components-folder and wanna limit every component i have in it to the "function" folder and dont allow other functions to work unless i say it in an "func_global.php", how can i do that? Over URL? Or do i need to make an attempt for everytime i call my component to search in the function-folder for a folder with the same name as the folder my .php file is placed in? This seems a little bit too much coding, so if someone has a better idea, please dont mind posting it here. I would appreciate it.
This seems enough for the start. Sorry for my bad english, i still need to learn stuff. But its better to ask than never know it.
With Greetings,
JamesHemmingworth