Page 2 of 3
Posted: Fri Aug 11, 2006 5:29 pm
by michael1991j
sorry
Posted: Fri Aug 11, 2006 7:27 pm
by michael1991j
well anyone
Posted: Fri Aug 11, 2006 7:36 pm
by Ollie Saunders
What are you asking again?
Posted: Fri Aug 11, 2006 7:57 pm
by michael1991j
ok if you saw the post of the code it wille replace the text on my blog but i dont know a way to make an array for the posts and and comments sectuon because there are not only one
ok if you look at the that the blog templete they have something common at the part that it array they show
<!-- Begin .post -->
and then
<!-- End .post -->
so if some one could figure like a loop but first look for <!-- Begin .post --> then <!-- End .post --> then it could like section out the code on that make a array with a loop
but what would i use to section out that strand of code in <!-- Begin .post --> and <!-- End .post -->
sorry for spelling
Posted: Fri Aug 11, 2006 8:14 pm
by Ollie Saunders
Posted: Sat Aug 12, 2006 11:22 am
by michael1991j
ok that didnt work but i found another function called split
ok one more queston
is there a function out that will seach for a word and then add text to the end of that word that the function found
thank you so far
Posted: Sat Aug 12, 2006 11:26 am
by feyd
michael1991j wrote:is there a function out that will seach for a word and then add text to the end of that word that the function found
Not in a single function no. It will require a few functions combined.
Posted: Sat Aug 12, 2006 11:57 am
by michael1991j
like
Posted: Sat Aug 12, 2006 12:07 pm
by feyd
I'll be blunt: I'm not here to hold your hand, nor do I think you want to be dragged through the code. So here's the functions that would be mostly involved:
http://php.net/strings
Try figuring it out first. Show us what you've come up with. We'll go from there.
Posted: Sat Aug 12, 2006 1:56 pm
by michael1991j
Posted: Sat Aug 12, 2006 2:02 pm
by feyd
I'm not seeing any code.. just a lot of <$> all over... what are we supposed to be seeing here?
You've got
private messages waiting.
Posted: Sat Aug 12, 2006 2:27 pm
by michael1991j
feyd | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
that is what i have right now i have left out the query and all that but that is the main codeing
Code: Select all
<?php
ob_start();
include('d.htm');
$pageHTML=addslashes(ob_get_contents());
ob_end_clean();
eval("\$pageHTML=\"$pageHTML\";");
$b = str_replace('<div class="entry" id="post-<$>">', '~<div class="entry" id="post-<$>">',$pageHTML);
$a = str_replace("
<ItemPage>
<BlogItemCommentsEnabled>","
~
<ItemPage>
<BlogItemCommentsEnabled>",$b);
$date = $a;
list($month, $d, $year) = split('[~]', $date);
echo $month;
do {
$c = str_replace("<$BlogItemTitle$>",$row_post['posttitle'],$d);
$e = str_replace("<$BlogItemBody$>",$row_post['entry'],$c);
echo $c;
} while ($row_post = mysql_fetch_assoc($post));
echo $year;
?>
i am having trouble the str_replace function it is is replaceing the ones that are close and not exacted for instsance
$c = str_replace("<$BlogItemTitle$>",$row_post['posttitle'],$d);
it is supose to replace <$BlogItemTitle$> but it is replace the ones that are close to
!!! like <$BlogItemBody$>
how do you make it replace the one that are exact and not close
Posted: Sat Aug 12, 2006 2:46 pm
by feyd
Yikes.
Code: Select all
ob_start();
include('d.htm');
$pageHTML=addslashes(ob_get_contents());
ob_end_clean();
eval("\$pageHTML=\"$pageHTML\";");
can, and should be, reduced to
Code: Select all
$pageHTML = file_get_contents('d.htm');
Stay away from
eval(). It wasn't even necessary in your code to begin with.
Split() is a regular expression function (using POSIX no less.) Your code doesn't require the power of regex as yet, so
explode() is a better choice. If you feel you want/need regex, use
preg_split().
There is a logical error in how you've used a minus sign for the splitting key. Specifically, you've got minus signs in the div from your first call to
str_replace(). I could suggest placing the splitting string into the source html file as say, an HTML comment like
Next, unless $BlogItemBody is an actual variable, I'd switch that string to a single quote one. Why? Because php will attempt to find such a variable. If it doesn't, it will fire an internal error. You may not see it, but that does not mean it doesn't happen. Now, since you've chosen to remove a section of code, it's hard to say if your logic for using a
do..while over the more standard
while was a good choice or not. I can only assume that you have already called
mysql_fetch_assoc() once (or more) already to retrieve the first record to be shown.
Posted: Sat Aug 12, 2006 3:05 pm
by michael1991j
that comment idea wont work because this is a paraphaser. so it is can read any of the blog templates at
http://blogger-templates.blogspot.com/
i built this phaser so i dont have to edit the template .
havent you read the first post
but thank with the heads up with that eval and shortaning my code
feyd | michael. You bump this thread again and I'll be forced to lock it. You've already attempted to bump three times since joining this forum. That's not a good way to get on the nice side of the moderators or our community. Have patience.
Posted: Sat Aug 12, 2006 7:05 pm
by Chris Corbyn
~michael1991j.... you've been warned about bumping enough times now. We've had to delete a couple of posts and we've prompted you to read your private messages. It's simple... don't bump. We don't like it, it's rude and it's unfair on everybody else waiting patiently for threads to be answered. This warning would have been easier to issue via PM but since you apparently don't check your PMs when asked here is your warning.
Thank you,
d11