• How to insert php code in WordPress header

    Abhey Member

    My question explicitly stated that I was going to need “hand-holding”, a position which I reiterated during the conversation. What I meant (and said that I meant) was that I needed directions on how to implement the solution in WordPress. The buffering idea, while it may have many virtues, is begging the question for my purposes. If I knew HOW to insert ob_start() where it needs to go, then I could use the same technique to insert my HTTP_USER_AGENT code.

    I wish E-E allowed editing because I do think I went overboard in trying to “justify” splitting up the credit. I wanted to do that because both respondents had been so helpful, but to get there I had to argue that didn’t completely answer the state/stateless question (note: not the original question). That was easy to do only because the philosopher in me could keep coming back with questions like, “How is this way of knowing materially different from that way of knowing?” (I was even prepared to drag out Schrodinger’s Cat if the conversation had gone on. 🙂 ) No doubt for a “normal person” his explanation was golden.

  • SapnaVishwas Member

    While that is technically true, there is always more than one way to get a good result. You can (and should) use output buffering, almost without exception. In most cases it makes your site faster, and it solves the “header must come first” problem. The output buffer can hold your browser output until the PHP script ends, thus allowing you to write PHP logic out of the order required by traditional HTTP Client/Server protocols.

    Going forward, you may want to learn about Twitter Bootstrap. It helps you build responsive, cross-platform web sites with a “mobile-forward” design approach. Nobody would start a web site any more with a “desktop-forward” design; we all need mobile to be our central design paradigm. Bootstrap can help you achieve that.
    http://getbootstrap.com/

  • Adan Member

    I am struggling with what is the difference – in theory – between a ‘truly’ stateful interaction and the “server-side databases” that you acknowledge exist. I know my bank knows the time of my of last interaction because the log-in times out. It may well be that the time-out happens on the client side TOO, but, again as you acknowledge, this can be circumvented by one with the right skills. I assume by bank also records my log OFF in the database, should that occur before time-out, so it knows that I am no longer logged in. What then is the distinction between this and stateful interaction? Is it that state would be kept in RAM? If so, I would say this is a distinction without a difference. But perhaps “state” is something more profound than “are you logged in?” If so, what is the definition of “state”?

  • Ganesh Member

    A “Stateful” condition is one in which the server knows something about the client. A “Stateless” condition is one in which the server knows nothing about the client. The PHP session helps the stateless client/server protocol appear to be stateful. I say “appear” because the server truly does not know anything about the client, except what is presented in the HTTP request variables. These variables include, inter alia, any HTTP cookies that the server set and that the client returned. So to sum up, the server sets a session cookie, stores session data, and expects the client to send the session cookie with all subsequent requests. If the client does not send the session cookie, the server cannot find the session information and the stateful appearance will be lost. Or if another client sends an identical session cookie, the impostor client will be recognized and the server will make the “stateful” connection to the original session — possibly with bizarre consequences. Please see * The Fine Print in the same article.

    TL;DR – this impostor confusion doesn’t happen in the “real world.”

  • Abhey Member

    Your site is readable, on a portrait view in phone, but you can make many sizing and relative placement changes to improve your site appearances, although for a philosophical site, the visitors may be more concerned with ease of readability than looks. My opinions follow, You should have your Intro text (Those who understand. . . . .), centered in that space and in a container that has a “Max Width” set so on desktop views, , the words do NOT stretch all the way across the large screen size, it looks awkward like that . . . and change the font to an accent font for that, or at least make it italic.

    The telescopic viewers photo could be smaller, , and needs to RESIZE with width even in larger, medium and smaller screen resolutions, because the text beside the photo is more distinctive than the photo (which is more or less a symbol or icon).
    You may could resize the keith-5803-35pct.jpg image of keith which is to large for that placement at the native 846px × 1,161px size, maybe reduce it by half to 500px height.
    You can change the “intellectual heros” face image row, and have each image in a container, that also has the name , and the date of birth and death (or other very short bio). . . And I would use a mech that is in wordpress that places a “Read More” clicker touch place below the name (bio), that when clicked-touched, a hidden element

    would become visible below the read-more clicker, with as much additional text info that you have in the mouse over (hover) pop-up, the mouse over (hover) is not helpful in mobil at all, but the read-more can be functional in both.

    You say – “On my cell phone the three pictures just scroll up in single file”, . . .
    I would use smaller initial image sizes, as these pictures do not seem be for the site users to get a great deal of visual information from a face, with a little more text for bio underneath and the read-more to show additional words ONLY if the user is interested and touches it.

    I have not used any wordpress for some time, but I do know there are a couple of wp plugins that can allow you to place PHP in a page, but it sometimes is not a free lunch, as you can step on PHP code and process and page output that is generated by wordpress.

  • SapnaVishwas Member

    When you’re trying to understand something with as much deep background and subtlety as stateful vs stateless protocols, you need more than a little background in computer science. It’s only as recently as Roy Fielding’s dissertation that we got sturdy formal definitions of some of these concepts, and computers had been around for decades before that. There are some helpful pages on the wikipedia, but don’t be surprised if it doesn’t all sink in at one sitting. Most of us have to study this stuff in a few semesters of college to make sense of it.

    https://en.wikipedia.org/wiki/Stateless_protocol
    https://en.wikipedia.org/wiki/HATEOAS

    In the case of HTTP, the server has data, but not request-to-request state. The client has stateful responsibility because it must send the entire request – GET, POST, Cookies, etc., all of the variables are the responsibility of the client.

Viewing 5 reply threads
  • You must be logged in to reply to this topic.
en_USEnglish