-
Posts
396 -
Joined
-
Last visited
-
Days Won
1
Everything posted by LeonLatex
-
No, I just looked over it and tried different things. I also compared it with other lines. It usually helps to get some sleep. I would think you recognize yourself in that. ๐
-
When I woke up I took it immediately. There was missing everything from a . on one place to a $ on other places. Even a = and god knows what. And Barand, maybe every error " are glaringly obvious" for you. Sometimes it isn't that for me. That's why I ask for help. This morning I could hardly hold my eyes open, but I want to fix the error, stubborn as I am. And Benanamen, what makes you think I haven't written the script my self? I have taken some frome here and another from there, "IN MY OWN SCRIPTS". So yes, much of it is cut and paste, but it's from my own scripts written by my self ๐ ๐ค Maybe it's just me, but I sometimes feel a certain undertone of arrogance in answers to me because I'm nowhere near as good as you at programming. That's why I'm asking the experts (you guys)for help. And it's not always as easy to see your own mistakes when you're so tired that you can barely keep your eyes up. Because it is not always as easy to go to sleep when you are engrossed in something. The cow should not forget that it has been a calf (a saying translated from Norwegian). All I want is to be friends with others with the same interest. And I am really struggling to get back where I once was. Sorry if I am wrong and misunderstood. Feelings aren't always the same on the internet as in real life. I also include in the calculations that language barriers may arise. Anyway, I appreciate the help I get when I get it.
-
I've been up all night looking at this. I can't understand where the error is. Now I'm tired and bored. It's 05:40 here now. I think i will find it after a few hours on my pillow. Good night/good morning ๐
-
I said I cant find the errors, so guess. I cant see them.
-
I get an error on line 38, 39, 52, 56, 58, 63 and 71. I cant find the error. I am looking and looking ๐ฎ Can you help me find it? <?php class EntryPoint { private $route; public function __construct($route) { $this->route = $route; $this->checkUrl(); } private function checkUrl() { if ($this->route !== strtolower($this->route)) { http_response_code(301); header('location: ' . strtolower($this->route)); } } private function loadTemplate($TemplateFileName, $variables = []) { extract($variables); ob_start(); include __DIR__ . '/../templates/' . $templateFileName; include ob_get_clean(); } private function callAction() { include __DIR__ . '/../classes/databaseTable.php'; include __DIR__ . '/../includes/dbconnection.php'; $articleTable new DatabaseTable($pdo, 'article', 'id'); $usersTable new DatabaseTable($pdo, 'users', 'id'); if ($this->route === 'article/list') { include __DIR__ . '/../classes/controllers/articleController.php'; $controller = new articleController($articleTable, $usersTable); $page = $controller->list(); } elseif ($this->route === '') { include __DIR__ . '/../classes/controllers/articleController,php'; $controller = new articleController($articleTable, $usersTable); $page = $controller->home(); } elseif ($this->route === 'article/edit') { include __DIR__ . '/../classes/contollers/articleController.php'; $controller = new articleController(articleTable, $usersTable); $page = Controller->edit(); } elseif ($this->route === 'article/delete') { include __DIR__ . '/../classes/controllers/articleController.php'; $controller = new articleController($articlesTable, $usersTable); $page $Controller->delete(); } elseif ($this->route === 'register') { include __DIR__ '/../classes/controllers/registerController.php'; $controller = new registerController($usersTable); $page = $controller->showForm(); } return $page } public function run() { $page = $this->callAction(); $title = $page['title']; if (isset($page['variables'])) { $output = $this->loadTemplate($page['template'], $page['variables']); } else { output = $this->loadTemplate($page['template']); } include __DIR__ . '/../templates/layout.html.php'; } }
-
Funny thing when you get so hung up on things because of a small glimpse of a feeling of mastery because you manage something that you haven't mastered in many years. When you deal with something that is structured and you forget to be structured yourself๐๐คช I have developed some different PHP files (actually a lot of them) for a CMS I am putting together, and just thought that I would put those files in this and those different directories. Until now, I have tested the different files that can be opened in the browser. Now I have reached the point where I can open index.php to test how this works when everything is sewn together. This is something that I now know in retrospect, I was very careful to note before for post-checking and a map that will save me the task I am about to start on now. It's extra work, but someone have do it. I have to go through each individual file and see what I have named each individual directory, and which files are linked to each other. Fun? NOT! I thought I would remeber it, but the project was getting bigger and i forgot. Does anyone recognize themselves? Moral of the day: Don't start a major task until you have a plan (written and drawn down)
-
Of course ๐ค๐๐
-
Sorry, Barand. Just had to ask since there was an option no one mentioned. I changed it to E_ALL
-
On the develop server (my local server) everything is set as you suggest Barand. On the production server (at webhuset) there is one difference. Error reporting is "E-all and E-notice". Is that OK or should it say only E-all? Display errors is set to off as you tell me it should. Log errors is set to on.
-
Do you mean like this? catch (PDOException $e_all) { $output = 'ERROR: ' . $e_all;
-
I have developed this database connection. I took a little from here and a little from there. I began to study it more closely. As I understand this, if this fails, it will release a lot of information to website visitors, such as passwords etc. Actually, the user does not need a lot of error codes if the connection to the DB is not successful. I am the one who needs that information. So how do I keep the print-to-screen information, but without the user on the website getting this information? I'm the only one who needs that information. Heres the script: <?php try { $pdo = new PDO('mysql:host=sql31.mcb.webhuset.no;dbname=**********; charset=utf8', '**********', '********'); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $output = 'No ERROR.'; } catch (PDOException $e) { $output = 'ERROR: ' . $e; } include __DIR__ . '/../templates/output.html.php';
-
As I already said, it makes it easier and more readable with white spaces. I feel it that way. So, when possible, I put in a white space where I can. What about this block: <?php function loadTemplate($templateFileName, $variables = []) { extract($variables); ob_start(); include __DIR__.'/../templates/' .$templateFileName; return ob_get_clean(); } Can I have a space between the period/dot and $ here too? .$templateFileName;
-
Ok, I like to have spaces too. It makes it more....... readable if you understand what I mean. I was not sure if it was this making the problem for me. If it depends if there is a space or not. Now I know for sure it is not here the problem is. I haven't looked into it today, so I don't know where the error is. But hope I find the error today. Thanks for helping me out and making it clear. I will look in ti your suggestion and see if I find out about this too. I bet you are into security reasons....๐ค Stressful day. ๐คชThis was awfully bad English. Anyway, I hope you understand.
-
Drop the value of dir? or do you mean that I should not use __DIR__ at all. What do you suggest I use as a replacement?
-
I think i got some trouble with the code pasted below: include __DIR__ . '/../Templates/' Is it correct with a space before and after the period or not?
-
Yes, you did. I read it before answering you, and it gave meaning. Thanks maxxd ๐๐
-
I have put together what is a class (took me about 3 days, and I don't know if it works yet) and a controller (took me about 2.5 days, which I don't know if it works either), but I came up with something under way today in terms of the controller script. When you think about the technical language of PHP, doesn't controller have another meaning as well than just to mean that a form has been filled out correctly?
-
After a long-awaited night's sleep, I reassembled the entire DIV stack with CSS. Then it was all right.
-
But what if these two DIV's is inside a DIV?
-
Faen! I didn't see the quotes. Thanks Barand ๐๐๐
-
Why can't I get the color I want? This is a color listed by W3 Schools: w3-win8-steel <a href='<?=$HOST?>index.php' class='w3-bar-item w3-button' 'w3-win8-steel'>Home</a>
-
That wasn't my question. I was asking for help if somebody remember that post where they have an answered me.
-
Previously, I think it was here that I got tips instead of setting up a page with templates as I have done before by importing "header.php, front.php, footer.php". <? include $ROOT.'header.php'; include $ROOT.'front.php'; include $ROOT.'footer.php'; ?> The thing is, I was told about a new way to do it. Can someone tell me the way to do it? I don't remember where I was told that.
-
Thanks, Barand. I made it with your second answer. The answer above is a good bonus.