mattvit Posted August 15, 2011 Share Posted August 15, 2011 Hey everyone, thank you for taking the time to read this. So I'm re-inventing the wheel..! Sort of. I thought it'd be a quick job to do, but it appears not to be. Basically, I just want to have a hash tag # in a variable. Is this possible? Ie, $twitter_msg = "I just was reading mattvits website, website.com #coolwebsites #awesomewebmasters" Is it possible to pass the hash symbol in a PHP variable? If so, how? I tried \#, didn't work. Again, thanks in advance!! Quote Link to comment https://forums.phpfreaks.com/topic/244819-creating-a-twitter-share-button/ Share on other sites More sharing options...
MasterACE14 Posted August 15, 2011 Share Posted August 15, 2011 it doesn't work just in the variable as a hash? I must admit I've never tried this. But you could always use htmlentities() on the string, or replace all hash tags with their html entity. Quote Link to comment https://forums.phpfreaks.com/topic/244819-creating-a-twitter-share-button/#findComment-1257573 Share on other sites More sharing options...
mattvit Posted August 15, 2011 Author Share Posted August 15, 2011 Oooh thank you! I didn't think of that. I'll give it a shot now! Quote Link to comment https://forums.phpfreaks.com/topic/244819-creating-a-twitter-share-button/#findComment-1257574 Share on other sites More sharing options...
mattvit Posted August 15, 2011 Author Share Posted August 15, 2011 It worked! But sadly the little hash/pound symbol didn't make it through the URL into Twitter. $tweetmsg = "content here ".$tweeturl." #firsttag #secondtag"; Any ideas? Would using a HTML entity for the spacing help? ... maybe I should try that... update: The entity spacing didn't work. I'm stumped. Is there some way for the URL to decode the HTML entity, rather than the web server?? Quote Link to comment https://forums.phpfreaks.com/topic/244819-creating-a-twitter-share-button/#findComment-1257575 Share on other sites More sharing options...
mattvit Posted August 15, 2011 Author Share Posted August 15, 2011 Ah ha! Found a question on stackoverflow which suggested the following. For SEO purposes (as there aren't many relevant results in Google) I'm making another post rather than editing. Here you go, world: $tweeturl = 'www.phpfreaks.com'; $tweetmsg = rawurlencode('CONTENT HERE'.$tweeturl.' #HASHTAG'); Thanks for your help anyway, MasterAce14! p.s. I don't know if it's just for newbies but this is one of the most spam-strict forums I've ever come across. The verification questions are extremely frustrating. I'm only 21 and couldn't care less about the Beatles (sorry!) so I had difficulty signing up initially... Pretty frustrating stuff. Won't be coming back here. (though I'm sure the members here are great ) Quote Link to comment https://forums.phpfreaks.com/topic/244819-creating-a-twitter-share-button/#findComment-1257577 Share on other sites More sharing options...
trq Posted August 15, 2011 Share Posted August 15, 2011 p.s. I don't know if it's just for newbies but this is one of the most spam-strict forums I've ever come across. The verification questions are extremely frustrating. I'm only 21 and couldn't care less about the Beatles (sorry!) so I had difficulty signing up initially... Pretty frustrating stuff. Won't be coming back here. (though I'm sure the members here are great ) We are also the largest php community getting around and get ALLOT of spam on a daily basis. It's just the price you pay. Quote Link to comment https://forums.phpfreaks.com/topic/244819-creating-a-twitter-share-button/#findComment-1257581 Share on other sites More sharing options...
phpSensei Posted August 15, 2011 Share Posted August 15, 2011 Sorry I can't let this slip. OP, are you serious? Your "fraustrated" because PHPfreaks likes to keep a solid user base and prevent spam? Any other board not taking the same security measures must really suck to be around because we rarely see any spamming going around here. edit: In all 4 (almost 5) years of being on this site, I have seen 1 spam post. We are the largest forum for a reason, because we are damn awsome. Quote Link to comment https://forums.phpfreaks.com/topic/244819-creating-a-twitter-share-button/#findComment-1257582 Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 15, 2011 Share Posted August 15, 2011 Sorry I can't let this slip. OP, are you serious? Your "fraustrated" because PHPfreaks likes to keep a solid user base and prevent spam? Any other board not taking the same security measures must really suck to be around because we rarely see any spamming going around here. edit: In all 4 (almost 5) years of being on this site, I have seen 1 spam post. We are the largest forum for a reason, because we are damn awsome. agreed. this is the only forum that i go to for PROGRAMMING. I've gotten help from awesome people and also, I've helped people. Quote Link to comment https://forums.phpfreaks.com/topic/244819-creating-a-twitter-share-button/#findComment-1257583 Share on other sites More sharing options...
MasterACE14 Posted August 15, 2011 Share Posted August 15, 2011 agreed. this is the only forum that i go to for PROGRAMMING. I've gotten help from awesome people and also, I've helped people. like wise. Quote Link to comment https://forums.phpfreaks.com/topic/244819-creating-a-twitter-share-button/#findComment-1257585 Share on other sites More sharing options...
mattvit Posted August 17, 2011 Author Share Posted August 17, 2011 Hey all, I take back my comments and apologise. I was doing a 24-hour all-nighter programming session and was starting to get the '-I'm-Tired-So-I'm-Angry-At-Anything' that I hope others get too..!! (edit: I hope others get it too because otherwise I just look like an angry internet troll! I'm not.. ) Your comment re: 5 years and 1 spam post really impressed me. I guess I just wasn't used to this system. Does the verification go away eventually?? ie once someone is an established member with x posts or x time here? Quote Link to comment https://forums.phpfreaks.com/topic/244819-creating-a-twitter-share-button/#findComment-1258451 Share on other sites More sharing options...
ZulfadlyAshBurn Posted August 18, 2011 Share Posted August 18, 2011 seriously, i hardly encounter any captchas. only during the signup, thats all. Quote Link to comment https://forums.phpfreaks.com/topic/244819-creating-a-twitter-share-button/#findComment-1258894 Share on other sites More sharing options...
Clarkeez Posted August 18, 2011 Share Posted August 18, 2011 I think I saw captcha on registration and on first post, thats it :S Quote Link to comment https://forums.phpfreaks.com/topic/244819-creating-a-twitter-share-button/#findComment-1258949 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.