« first day (720 days earlier)      last day (4222 days later) » 

12:00 AM
@fallenAngel But @DaveRandom does make a valid point with the extra request.
 
@NikiC Well when you put it like that, basically a whole bunch of string concats and echos. Which yes, is probably worse, all things considered. This is exactly why I much prefer writing code that does stuff over code that generates markup.
 
Sorry, I still do not understand
a bunch of string concats and echos, isn't that basically what templates do?
 
@rdlowrey that topic made me want to cry
 
Store all your DB content in a big JSON string and problem solved ;) j/k
 
@ChrisClower yes, overall JS implmenetion will not be nice in my situation though
 
12:03 AM
i think i'm gonna write an answer there (though it's 3AM here)
 
OK Mr smarty-pants, explicit string concats and echos. I.e. <?php echo "<div>".$content."</div>"; ?> vs <div><?= $content; ?></div>. And yes I know it's functionally almost identical.
 
user895378
@tereško Yeah -- I'm a little embarrassed for the stack overflow community that no one in ~21 hours has been able to provide a suitable answer to the question.
 
btw , what is Dave fussing fuming about ?
 
Ewww, yeah echoing out code and doing concats like that is really bad lol
 
:-P
 
12:04 AM
@rdlowrey my excuses is that i have been playing Deus Ex (1)
 
@rdlowrey I talked to him a while last night and set him at least in the right direction
 
i have got to Hong Kong levels
 
Basically I'm showing myself up again.
 
@DaveRandom lol apparently i was just taught how to use jquery while i was AFK
 
user895378
@tereško I was hoping someone else would because I didn't really feel motivated. On the bright side, that's the kind of answer that you can turn into a canonical reference and massive upvote getter when done correctly. I'll certainly upvote.
 
12:05 AM
Happy coding, see you later...
 
perhaps i should rephrase the question what is the other way of implementing templates without the placeholders (like smarty used)
 
@DaveRandom You make me feel really stupid now, since I still don't get it. I don't see what difference it makes.
 
Ok, where is the full question at? I came in a bit late and saw "<div><?php echo $content; ?></div> looks too dirty for HTML designers" and jumped in prematurely. My apologies.
 
... priorities .. tea now , answer a bit later
 
@ChrisClower I was just joking with that, we were referring to someone who jumped in here asking how to write templates.
 
12:06 AM
@rdlowrey I already lost 5 downvotes on that question
 
@NikiC so did I
 
Had to dv every single answer :/
 
actually 6 now
there was just another awful answer omg
 
Oh ok, sorry about that.
 
@NikiC Readability only. Which to a large degree comes down to personal prefs. But I'm almost 100% certain that if you look at something like twig then either of the two options above are a million times better.
 
user895378
12:07 AM
@NikiC @Lusitanian lol I was actually filled with a sense of pride that all the answers were down voted -- I knew that was the work of :)
 
(efficiency wise)
 
> "Also I dont know where you get the idea you're not 'supposed' to create objects inside other objects. There's no reason to avoid doing that." --GrandmasterB
 
user895378
Yeah, those answers are a comedy of errors and bad practice.
 
That might be my least favorite SO quote of all time (and by all time I mean the three months since I've been here).
 
Yeh, fuck DI. Tight coupling FTW!
 
12:09 AM
Let's abandon testing, reusability and clarity in exchange for twenty minutes of time at the beginning of our project which we could be using for watching videos of cats jumping into boxes and falling over.
 
user895378
@Lusitanian sold.
 
What's wrong with creating objects from within other objects, assuming he's referring to creating instances of objects? If he's talking about writing objects inside objects, then yeah... lol
 
@ChrisClower He's referring to creating instances of objects, and there's much wrong with it (also shoutout to the fact that you're from Youngstown)
 
@DaveRandom Then let's get rid of all function parameters, and let's use globals everywhere instead :-D (result: guaranted total mess)
 
guys
 
12:10 AM
Like what?
 
why don't you go answer that question?
 
@ChrisClower You tightly couple your code to the implementation of those objects
 
@ChrisClower did you ask me for full question?
 
@NikiC we're far too busy making fun of the responses to it, can't you see??
2
 
Yes, please send the a link to the question
@Lusitanian You from the area?
 
user895378
12:11 AM
7
Q: Dependency Injection: How to pass DB around?

StephaneEdit: This is a conceptual question first and foremost. I can make applications work without knowing this, but I'm trying to learn the concept. I've seen lots of videos with related classes and that makes sense, but when it comes to classes wrapping around other classes, I can't seem to grasp whe...

 
@ChrisClower Relatives there.
 
@rdlowrey, you'll save us and provide a nice answer to that question, right?
 
user895378
@NikiC In the process of ...
 
@Lusitanian Ah, ok. I'm actually from Vienna (north of Youngstown), but no one knows where that is, so
 
@NikiC I'm tempted to do it because as someone said above (too lazy to look) it's a highly upvote-whorable question
 
12:12 AM
please append my nick, who ever replying me. i am loosing track as so many people are around here
@ChrisClower wait a minute
 
So the question is basically about MVC
?
It seems multipart
First, it asks about creating objects within objects, then starts giving implications that the OP doesn't fully understand the MVC pattern...?
 
Oh, btw, I have something nice for you (from teh C++ room):
Enjoy!
 
@ChrisClower Vienna is like 4500 miles east of Youngstown, actually :-P
(yes, I actually bothered to work that out)
 
Chris .. i have no idea what you a mumbling about ...
 
@DaveRandom :D Wrong Vienna haha
 
12:17 AM
 
@fallenAngel I think he meant a proper SO question, as in
 
@fallenAngel -.- then what the hell is this MVC question? lol
 
Oh, and be sure to scroll through that pastebin. After that you'll realize that no matter how bad those DI answers are, they at least aren't that bad.
 
Yeah I was asking for the chat question and got linked to an SO question about MVC, thanks for the link fallen
 
@ChrisClower I dont know. it did not make any sense and so i was loosing the track
@DaveRandom aaah
 
Ok then, @fallenAngel - if you can't use a templating engine, you have to either echo it from PHP or use AJAX to insert the data, back on track now
 
@ChrisClower no problem
 
But you said you don't want to use JS, so...
<?php echo ?> would be the proper way
You could use short tags as you suggested <?= ?>, but it's bad practice for compatibility reasons
 
I will just say here, and I hope no-one will disagree on this, that the DOM suggestion is a bad idea
 
12:23 AM
If the server doesn't have short tags module enabled, it won't work. Likewise, if they switch servers, it could produce problems later
 
me? i did not suggested short tags :D
 
Someone suggested short tags
 
what's going on .. i am getting cofused
also ...
 
@tereško Don't feel bad, so was I - seems there are a few people asking different questions, so there are different covos going on at the same time
 
@ChrisClower php already IS a templating engine
 
12:25 AM
That's what I said originally
 
and then you changed you mind ?
 
Repetition FTW! I'm going to bed before this debate comes full circle a second time.
 
4 mins ago, by Chris Clower
Ok then, @fallenAngel - if you can't use a templating engine, you have to either echo it from PHP or use AJAX to insert the data, back on track now
 
Someone said <div><?php echo $content; ?></div> wasn't clean enough, even though it's the only viable answer, so I said the only way to make it cleaner would be using AJAX
 
12:26 AM
hmm ... i need 5 more upvotes for the silver
ajax is never "cleaner"
 
They are concerned about the aesthetics of the HTML code
 
@tereško AJAX is a cleaner.
2
 
@ShaquinTrifonoff ok .. i cannot argue with that one
 
Everyone should shut up and go read from here downwards before continuing this debate chat.stackoverflow.com/transcript/message/5634206#5634206
 
all those letter ?
 
12:29 AM
and now I really am going to bed because I am
 
why should i read the backlog, if i do not care what any of you have said ?!
 
Just because this is a massive rehash of a debate that has already been had
 
Oh, I see that @tereško is being nice once again :)
 
So I said the only way to make the HTML cleaner than <div><?php echo ... ?></div> would be to grab the data with AJAX and insert it into the empty HTML container
 
right seriously, actually going now
night all
 
12:30 AM
night @Dave
 
later man
 
@NikiC deadpan .. internet .. bad
 
If anyone knows of a better way than to actually echo it then let me know
 
night @DaveRandom (just got back i'm sure i missed lots of f un conversation)
 
or a "cleaner" (from an HTML code standpoint) way than to use JS to insert the data into an empty container, please chime in
 
12:33 AM
@dave thnx, good night
@ChrisClower had you read my proposed DOM way?
 
@ChrisClower I'm very confused on what's getting argued about
 
I don't know, I suggested using AJAX when echo was ruled out, and that's been the focus of a bunch of bashing ever since :)
@fallenAngel What was the DOM way?
 
meh
 
the impression that i get is : everyone kinda wants to disagree , but nobody cares enough to argue properly
3
 
12:37 AM
That would require JS
You can't have PHP check the DOM without using JS
What you were talking about right there would be using AJAX
 
@ChrisClower no, i mean loading it in DOmdocument php.net/domdocumnt
 
PHP can't read the DOM by itself and do anything on the server
without some kind of POST
and PHP can't do anything to the DOM by itself either
 
It can, you can load html file and use the DOM operation quite same as JS implementetion
 
Right, but you're talking about reading DOM changes and updating the database
 
i mean first it will load the html template in domdocument and then populate with content and then echo it back to browser
 
12:41 AM
DOMDocument can't do that
but why?
You don't need to load the HTML template into PHP for any reason that I can think of based on what you're trying to do
If you just want it to echo out content, then just echo out the content
But in the question you linked me to....
You were talking about updating the database, am I right?
You said you want it to be editable and map those regions to the DB
From what I gathered
 
<?php
ob_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>Sample page</title>
</head>
<body>
	<div id="content"></div>
</body>
</html>
<?php
// Set content here
$content = 'blah blah';

$html = ob_get_contents();
ob_end_clean();
$dom = new DOMDocument;
$dom->loadHTML($html);
$node = $dom->getElementById('content');
$add = new DOMDocument;
$add->loadHTML($content);
$elems = $add->documentElement->firstChild->childNodes;
foreach($elems as $elem) {
	$node->appendChild($dom->importNode($elem, true));
 
@ShaquinTrifonoff -.- no
 
@ChrisClower I think that is the DOM way --^ ;D
 
Yeah that would be bad
Fallen don't do that
That would be a nightmare for maintenance and for designers lol
Yes, that's the DOM way, that's a lot messier than just using echo
 
why do you try to imply that this has anything to do with designers ?!
 
12:48 AM
@ChrisClower Yeah, if echo is all that is needed, then echo should be used.
 
@tereško That's the concern with the aesthetics of the HTML code. "Designers might get confused"
That's why apparently echo isn't going to work for OP
Designers might get confused about the php tags
 
who is OP , and why the question has not been closed yet
if designers get confused by tags , then do not let them look at the code
 
If they do, I say hire new designers lol. There's nothing wrong with it and they should know the difference between HTML and PHP tags, if not, fire them lol
 
hell .. designers should not be responsible for making HTML/CSS in first place
 
I think they mean the HTML/CSS coders (sometimes lumped in with "designers" generically)
 
12:51 AM
the bottom line is this : drop the subject
 
Why? The OP had a legit question
 
the word you tried to spell is "legitimate" , and the OP is not here
so shut up and stop fuming
 
You just said you didn't even know who the OP was
Excuse me? lol.. who the hell are you again?
Also, I don't need a course on proper English and grammar from someone who barely knows the language
Thanks though
 
@ChrisClower So, for instance, you can use auto_prepend_file and register_shutdown_function. Designers won't get confused.
 
@ShaquinTrifonoff That's true
Does it clean up the HTML at all?
 
12:58 AM
@ChrisClower What do you mean?
 
@ShaquinTrifonoff jsut stop , he has been going on and on and on about the same stupid subject for 2 hours
the person who asked it originally is long since gone
 
@tereško Ok then, let's change the subject to whatever you want to talk about. Or, maybe you prefer complete silence, in which case, why are you even in a chat room?
 
Who cares if he's gone? It doesn't matter. We're having a discussion. If you don't like discussion then maybe you should leave?
 
@ChrisClower So you were asking if it cleaned up the HTML?
 
1:06 AM
@ShaquinTrifonoff Yeah how exactly would it help with templating?
 
@ChrisClower Help in what way? It will correct badly-formed HTML.
 
How?
It's not HTML Tidy
All auto_prepend does is place something before other content
it's the same as include and require/require_once
 
@ChrisClower Aha, but with output buffering, you can process the HTML.
 
and auto_shutdown just calls something after the script finishes
Ok, but it doesn't correct badly formed html
 
@ChrisClower I'll give you an example.
 
1:13 AM
That's what Tidy is for, but Tidy doesn't work on most servers
k
all output buffering does is prevent something from being displayed (stores it in RAM) until it's flushed
so i'm not following
so you're suggesting loading the HTML file into memory, then processing it, then displaying it
am i right?
 
@ChrisClower Yes.
Try giving it this input:
$content = <<<END
	<div>
	<a href">>blah</a  >
	<p ><<<<>>>>asdf></
END;
 
That could work, but the parsing would be a bitch
 
You will have to also put libxml_use_internal_errors(true); to avoid HTML errors being displayed.
 
all the ids and such used would have to be hardcoded into php as some kind of keyword, probably a list of them in an array or an object...
 
@ChrisClower The output:
<!DOCTYPE html><html lang="en">
  <head>
    <meta charset="UTF-8"/>
    <title>Sample page</title>
  </head>
  <body>
	<div id="content"><div>
	<a href="">&gt;blah</a>
	<p>&gt;&gt;&gt;asdf&gt;</p></div></div>
</body>
</html>
 
1:18 AM
it seems like it would be overly complex, although definitely a way to keep php out of the template
but the php would definitely need to know where to put what, of course, but that's also what complicates it because every ID and class would need to be coded into the php for parsing, which gives the HTML a lot less flexibility
 
@ChrisClower No..?
Oh, like id="content"?
You can always tokenize the string...
<div id="content">{{CONTENT}}</div>
 
right but that's how templating engines work
if we're sticking to the OP's question (we don't have to), then he said he can't use those
but we don't have to stick to his question, it's just conversation at this point
I have no issues though with discussing how to build a templating engine :D
actually, i have my own question
i've been hired to build a custom CMS for a client. it pretty much does have to be custom because they have requirements that don't fit anything existing...
maybe i could mod something else, but that's never been my style
so of course the first thing i did was start on the user stuff
registration, login, roles, standard stuff...
it's all AJAX and does validation and unique checking on the fly
workes great on my localhost, but i uploaded a test to the server....
validation and unique checks work great
login and registration don't
 
@ChrisClower Sounds like a database issue.
 
for some reason the ajax request on submit is returning a 500
COULD be, even login is doing inserts....
because it updates things like last_logged
but i can't figure out WHY it's erroring
it works fine on WAMP
 
@ChrisClower Have you checked .htaccess files?
 
1:30 AM
all the DB stuff i have done using CodeIgniter
yes
everything is fine there, just some mod_rewrite stuff for clean urls
and some stuff to restrict access to certain files and folders, and url hack attempts
but all that should be fine
i suppose i could strip it all out 1 at a time and see what happens
 
@ChrisClower I assume you have got the rules to check if a file exists before rewriting?
 
just to rule out htaccess being the issue if nothing else
yes
 
@ChrisClower That is a good idea.
 
well, it's not file-based rewriting, but yes
i'm making sure the url or whatever exists in some way or returns 200
since it's a cms it's all db driven so it's just loading index.php with some db requests of course with the url being the condition
(checks a portion of the url against the defined page slugs in the db)
now, that COULD be causing some kind of problem, but i don't think so
 
@ChrisClower What happens if you try to access the login script directly through your browser?
 
1:35 AM
because if it's not a valid page slug according to the db, it looks for a controller file
it's not possible because i have it set up to make sure the request is ajax
access to scripts through the browser without the use of ajax is not possible this way
if you're suggesting i test it that way, then i can comment out the line that checks for XMLHTTPRequest
i'm thinking it's probably some kind of content encoding error
 
@ChrisClower So how do you make sure that the request is AJAX?
 
like the data might be being sent under some kind of encoding that the server isn't expecting, but I've pretty much made sure everything is UTF-8 i think
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { //stuff }
should be ===, thought i caught all those and fixed them ;)
but still it should work
 
@ChrisClower Put die('**TESTING**'); at the first line in { //stuff }.
 
wow ... codeinginter user .. that explains things
 
ok 1 sec
500 internal server error
@tereško This is the last time I'm going to respond to anything you say, so you should go troll somewhere else if you want to get a rise out of people
 
1:46 AM
@ChrisClower Try disabling the .htaccess rules.
 
@ChrisClower You can ignore people if you have had enough of them, tereško does it all the time.
 
I'm not worried about it
CI is a really good framework (and there's nothing wrong with using a framework to speed up development and make money faster), so it's an obvious troll
Ok, .htaccess rules commented out and now I'm getting 404 errors on the ajax requests, that's interesting
 
Aug 16 at 19:59, by SomeKittens
codeigniter advice: Don't use codeigniter
 
Not sure if it's related to the problem, but it's interesting because it's not really supposed to affect anything
what's wrong with codeigniter? just curious
i'm relatively new to it
 
1:50 AM
@ChrisClower Hmm, did the rewriting rules rewrite the login script URL to somewhere else?
 
Hi guys, does \\\\ become \\ when displayed in double quotes, or does it become \\\? A recent problem has let me ask this question.
 
seems great so far
 
@ChrisClower CI is one of the worst frameworks for PHP. It is build around global state , still uses PHP4 style for object instantiation , the MVC it implements is a joke
 
no, CI2 is purely php 5
 
lol
 
1:51 AM
and the MVC pattern is up to you. you can do it right or do it wrong
 
then what is $CI = & get_instance(); or $foo = & load_class('foo'); ?
 
you are referring to the old CI
never seen that in v2
go download 2.1 and tell me it uses PHP4 workarounds
 
@think123 I don't really understand your question
 
1:54 AM
@ChrisClower don't worry, I got it now. Thanks.
 
Might be a couple things left from the old version, but CI2 is advertised as incompatible with PHP4
 
... i think this should be enough , @ChrisClower , it's all from CodeIgniter 2.next
 
A few examples of leftover old code isn't convincing
 
have you actually READ codeigniter's source ?
 
1:56 AM
Besides, it's regardless still the fastest PHP framework besides compiled frameworks like Phalcon
 
The best framework is four letters long. Guess what it is? none.
It's the fastest, too.
 
even the 100% php 5 fork of CI, Kohana, is nowhere near CI's speed
 
@ChrisClower fastest ? how did you measure it ?
by comparing the execution time of "hello world" ?
i hope you are joking
 
i didn't have to. there are benchmarks everywhere. you should try using a search engine and look for some.
and they didn't do anything with hello world, btw
they measured a lot of things including db calls
which is the primary bottleneck with anything, so
 
if you believe in benchmarks, then there is noting i can do
 
1:59 AM
they also measured how many files were called and how fast they call them
then tell me, how do you measure speed?
 

« first day (720 days earlier)      last day (4222 days later) »