Hey folks.. I would like to ask for a little help, if someone has some knowledge in PHP coding. The help needed isn't much, and almost qualifies more as code hacking than coding. Or....just changing small things in existing code to work 'just right'. It's that fine tweaking that I can do some of, but not all. (I'm no natural PHP coder, myself) Like, at the moment, adding content caching to a .PHP file.
If someone can help a bit, let me know. Its for HH related things, and to make the site better, and of course, volunteer for the bit of time it may represent on something specific.
Okay.. I'm struck. What is currently in the sidebar is what it looks like with all 3 elements of the Hernando's RSS feed displaying in natural order. Nothing done but to add a horizontal line and then coloring in CSS code. (this is as much to explain for helpful reference, as it is to give background for asking for specific help)
This is what we have to work with (or what I have to work with), for the raw feed text.
This is what that comes from for what I keep calling the RSS feed (and is a link in the bottom information section of the main forum page
[CDATA[The latest topics from ![CDATA[When mainstream media out and out lies to further an agenda]]></title><link>http://www.hernandoshideaway.net/thread/774</link><description><![CDATA[Last reply by adjensen on Tue, 06 Jan 2015 16:45:14 +0000]]></description><pubDate>Tue, 06 Jan 2015 16:45:14 +0000</pubDate>
The RSS feed is just a text file that websites make available and put a link to (or not) and which sit there for someone to do exactly what we're doing, or watch headlines without visiting sites by using an RSS reader on their own computer (like these). Some feeds put out a lot of information, but ours is simple and you can see inside the above 'code', where the details in the feed come from.
This is where I need help for anyone with ideas or some experience with PHP. This is how the feed breaks down.
#1 is the thread title or [TITLE] #2 is the time/date line of the RSS feed Hernando's is generating automatically or [DESCRIPTION] #3 is is a published date I should be able to change, but am just having no luck figuring out or [PUBDATE]
This is the PHP code for precisely how that is done for each listing.
Light blue is part 1, green is part 2 and pink is part 3 as it corresponds to the first graphic of the finished feed everyone sees.
What obviously needs to happen is changing the time being shown on #2 or #3, and then to truncate #2 to at least drop the time zone offset (that '+0000') on every line, and I'd like to dump the whole date from #2 to use #3 alone.
I'm failing in finding how to take the above variables and do string functions (change what parts of the text show up or change something like a number).
right at the start of the specific PHP file I was working in? Doh! I can't believe I didn't think of that.
Thanks! Now part #3 reads correctly, and I can drop part 2 for a clean display right now. Except...we lose the Last Reply By.... and I really value that. I imagine others do too..
So... Now any ideas on how to truncate a string PHP is working with from outside the script this way and before it echos back?
Sorry, I mean it's drawing the [DESCRIPTION] variable from the rss file, and it's bringing it in as a complete string. I just worded that poorly. I only want the first half of that string, and to drop from the word "on", forward.
If we can get that, then we have a 100% working and reliable Recent Threads from here on.
It might help if you can see the whole file this is coming out of. The PHP I am using is a drop-in extension out of Wysiwig WB 10 and this one just does this function. I've modified the code to do a few things here and there, and display a bit different..but I'm not finding applicable examples online that apply for how I'd cut that line off here.
factcc.net/tuts/rss_parser.php Right clicking and saving should give you the original to see full context. PHP isn't my thing, as I mentioned, so there might even be a different part of the file I want to change for basically just taking the first 5 words of [DESCRIPTION] and nothing more. (That covers to the name)
That's the "post-processing" version of the file, I would have to see the original source.
Did my snippet up there not work? The one that uses "substr" to return a substring.
As I understand it, PHP is a preprocessor, it creates web pages dynamically on the server and then you can do additional processing on the client end. I could write up some javaScript that would do the truncation for you, but that would needlessly complicate things if it can be done entirely within PHP, which it should be able to.
Hernando's Hideaway Plank Owner America's best radio station: wfmu.org | My Reality Remix topics blog: Here
What you put up there isn't quite working, no...but it led me off in a direction that may... I'm not just trying to be humble when I say PHP isn't my thing, and I am really dependent on visual environments for making things. (pages..apps..etc), so I hadn't even recalled what I'd read once about renaming the variable that way, which then made perfect sense for....
It's the precise syntax I'm playing with, but I spent a little time here this afternoon making a new mini-site for testing HH related things, so I don't have to adjust anything but the final update on the live front end anymore. :)