Jump to content

Use Css To Modify Echo Color


sildona

Recommended Posts

I have the style sheet called in the PHP file's head. It's the wrapping in html markup that's throwing me.

 


echo <style="color: $fff;" stripslashes($imgrow[blocks]). "<br/>";


echo stripslashes($imgrow[blocks])." <br/>";
echo "<div class='blocks'></div>";

Link to comment
Share on other sites

I really don't get this -- why would want to include more line-break tags?

 

Really, I can write HTML well enough, so that it works. I can work my way through CSS just fine, and when I can't, tutorials help. But I'm not understanding how to wrap PHP echo statements with HTML. I just need to change the color of a measly piece of text. Telling me the concept isn't going to work. An example might be nice. In carpentry, for example, telling someone how to frame a wall and showing someone is the difference between some true and a not-very true corners.

 

I have tried about 18 different examples from tutorials placed online, and if I just flat out copy and past them in a new php file, they still tend not to work. It's like everyone has a library of different, non-working examples.

 

For example:

 

echo "<div class='cars'>" ($variable[cars]). "</div>";

 

doesn't work.

 

Yet I'm told it should.

 

But I'm telling you ... it ain't happenin'.

 

Parse error: syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’ in /............ eval()’d code on line 68

 

Any help anyone?

Link to comment
Share on other sites

I don't want to write perfect code. I want workable code. I don't know if the stripslashes are needed, but the "blocks" variable comes from a form that inputs some data that may or may not have comma's or other stuff in it, so I added the stripslashes. Is that wrong?

 

If it is, I don't mind. They don't give me error messages. They do allow the text to echo as its entered.

 

I don't need a better, more pure, more esoteric way of doing this. I just need the output to be a certain color, which means calling the CSS file, which I swear to God is not making sense to me.

Link to comment
Share on other sites

Parse error: syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’ in /............ eval()’d code on line 68

 

That makes me think you're definitely doing something wrong. Where is that coming from?

 

Nobody that knows anything about php would tell you this should work: echo "<div class='cars'>" ($variable[cars]). "</div>";; it has syntax errors.

Link to comment
Share on other sites

First, Jessica and Picachu2000

 

I really want to thank you both for putting up with my questions. I mean that. My background is English, and I get annoyed with people who don't appreciate or don't really want to learn what I think is very important. However, as an educator, even when I'm annoyed, I provide specific answers to specific questions I find tedious. Students of English are not always at the same point in their writing careers, and if they don't care--if they only want the answer--making their lives difficult only makes them resent me as well as the subject matter. Making their lives easy ... a.k.a, improving their lives ... in a way that serves their function rather than mine, keeps them close to the subject and will enable them to re-approach the topic at some later time with a positive mindset.

 

Although teaching coding is similar to teaching writing, it's more like teaching business writing. Students of business writing have specific goals .. how to write a pitch, how to draft a business plan, how to do a PR, etc. Their mindset is functional rather than conceptual, and although they understand the importance of grammar and syntax, neither are their primary concern. Why? Because they are business people who can have a colleague proof the letter.

 

When it comes to coding, I'm similar to the business-writing student. I have specific goals. I don't really give a can of shit about the security of the code because I have to get a working model in place that will allow me to conduct a private beta-testing, something I can run by others. Following that, I will pay someone to make code the site and fill in all the gaps, so to speak.

 

So again, I really thank everyone in these forums for putting up with questioners of a business mindset. You people really find us annoying. Sorry.

 

That said, considering myself an idea man, this is my idea:

 

Think of a forum as an a single entity. Forums are amusing, very schizo places. Going back over not only this thread but over others, the overall personality is a mercurial. Although they are comprised of many users, think of PHP Freaks as PHP Freak.

  1. Religious: arguing about the absolute best, most moral way to code something:
  2. Bitter: don't want to dole out a single example because coders are angry about "spoon-feeding.
  3. ADHD: getting sidetracked away from the topic.
  4. Passive-Helpful: conceptual answers without specific examples (this is very close to #2.
  5. Helpful: conceptual answers with examples
  6. Chatty, Friendly: between questioners and regular users
  7. Identify other characteristics, say 10 total.

Problems (market or audience)

  1. Supposing the singularity will be a hive mind, how to predict the personality that will win out (and therefore the nature of existence)
  2. Entertainment - perhaps a game
  3. Think of some more markets or audiences

Code the Solution

  1. Write program that mimics or uses the forum model as a metaphor
  2. In terms of Problem #1 -- think of earthquake prediction ... input a lot of variables -- output earthquake predictions & effects. Similar thing: input various personality or objective survival goals and output the Singularity hive mind's most probably "personality" or "nature of existence."
  3. Entertainment (or even functional) Think of Yahoo! Answers, and model a visual site that uses the forum as a model ... A sort of schizo virtual assistant ... these already exist, but do any of them have a personality of anything other than an encyclopedia that has undergone customer service 101 training?
  4. OR program a forum-based virtual assistant -- a sort of Schizo sage -- that seeks to identify the questioner and give an answer that bests suits the person rather than the question ... many people might find this maddening. But designed and marketed properly, it could be like some wise mentor of sorts that frames answers like a zen koan. Sort of like Harry Potter getting seemingly confusing answers from Dumbledore.

 

I don't have the time, knowledge, or inclination to start the above project, but it could be interesting and profitable if done right.

 

Best

Link to comment
Share on other sites

I have very specific goals, too. One of them is not to help someone do something the wrong way, whether it's what they desire or not. To knowingly do otherwise would be irresponsible, and only serve to reinforce the misguided perception that as long as something "works", it doesn't need to be done properly. There's rather a large difference between overlooking improper sentence structure and supplying or even endorsing bad code. The latter can potentially enable a morally challenged visitor to cause the complete undoing of countless hours of someone's work in mere seconds. Because most of us actually do care when something like that happens, if a person starts implying they don't care about the right way, the likelihood they'll be ignored increases dramatically.

Edited by Pikachu2000
Link to comment
Share on other sites

Especially when that person is a newbie coming in and trying to tell people who've been here for years that we're using our forum wrong. 

 

You get paid to put up with shitty annoying questions. We don't. We're going to do whatever the hell we want with our time, and for me, it's tell someone they're being a moron when they can do

echo stripslashes($imgrow[blocks])." <br/>";
echo "<div class='blocks'></div>";

But it takes them a full day to figure out how to put the div around the function, and they still do it wrong. Are you seriously telling me that you have a professional career as an educator, and you can't extrapolate that if you can do 

echo stripslashes($imgrow[blocks])." <br/>";

You can do 

echo '<div class="blocks">'.stripslashes($imgrow[blocks])."</div>";

 

Furthermore, you need to turn on error reporting to E_ALL because your current code should produce some warnings. If your plan is to hire someone to finish the project, why not hire them now to do it right from the start? Anyone worth their salt will look at your existing code and scrap it anyway.

Edited by Jessica
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.