Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Navigation
Latest Addons
AD Gallery 60
SyntaxHighlighte... 51
Newsletters v4.03 112
Facebook Like Box 130
Newsletters v4.02 58
Metro 165
Facebook Connect 171
Shoutbox Panel 128
Redactor for PHP... 107
MI Floating Side... 109
Facebook Login/R... 154
Avatar Studio v2.03 180
Relationship Sta... 98
Sexual Orientati... 116
Fisherman 144
Popular Addons
iTheme2 5807
Arise 5793
User Control v1.23 4622
Event Calendar 4052
Photowidget panel 3888
Radio-Theme red2... 3358
Highslide Gallery 3315
CSS/JavaScript D... 3234
Facebook Connect... 2987
Dynamic Menu 2894
Slideshow Lightb... 2724
L-AMANT 2659
Enigma 2637
2Dark 2607
Black 2580
View Thread
Official Home of PHP-Fusion » General Addon and Modification Support » Ideas for Modifications and Requests
Who is here? 1 guest(s)
 Print Thread
Replace in output question
smokeman
Hi folks.

I have a question about the replace_in_output() function.

If I want to insert something in viewthread.php right after this line:

Posted on 15-03-2012 21:35


- so it becomes to eg;

Posted on 15-03-2012 21:35 | bla bla bla


How can I do that - if it's possible.
 
http://www.phpfusion-tips.dk/
skpacman
Normally, you'd be replacing something in the html source that looks like an html comment

like this:
Download source  Code
<!--forum_thread_user_name-->




I don't see anything unique in that specific spot that could be replaced though.

I assume you've already looked over this guide.

I haven't messed with output replacements much, but I do know you need to find something in the HTML output that is unique that you can replace.
 
http://www.php-fusion.us
Tyler
smokeman - for what its worth
Download source  Code
replace_in_output('Posted on ([0-9_-\s\:]{1,20})', 'Posted on \1 | Blah');




works. I'm no pro.... check spelling I'm on my phone.
 
skpacman
heh, regular expressions are your friend
 
http://www.php-fusion.us
smokeman
@Mittens Returns: Thx - that was exactly what I was looking for! Now I think I understand this in a better way too.

Thank you again. Smile
 
http://www.phpfusion-tips.dk/
Tyler
It is very handy. its real easy when there's specifics nearby... if you apply that code right you shouldn't have an issue but you could then be selecting say news post or similar... where ever you put it you could check for /forum/ in url then execute the code

glad it worked for you.
 
smokeman
Ahh ok I see - good to know. I just make an url check for that part then.

I think I maybe explained myself a bit wrong before.. What you supposed is working like a charm. But if we look in the php code for that particular line I want to change then it look like this:

Download source  Code
echo "<div class='small'>".$locale['505'].showdate("forumdate", $data['post_datestamp'])."</div>\n";



- and what I want to do I can easily do in the file itself:
Download source  Code
echo "<div class='small'>".$locale['505'].showdate("forumdate", $data['post_datestamp'])." ".strlen($data['post_message'])."</div>\n";




And I thought I could solve it this way:

Download source  Code
$chars = strlen($data['post_message']);

replace_in_output('Posted on ([0-9_-\s\:]{1,20})', 'Posted on \1 | $chars');





But that of course won't work. Is it possible what Im trying to do - if you understand what it is Im looking for btw ?
 
http://www.phpfusion-tips.dk/
Tyler
you need to put '. before chars variable and remove single quote after $chars
 
smokeman
Ahh yes - now I see.

I guess I have to make a new query then ? Because now it shows 0 in every posts. And I want it to count/show how many characters there are in every post.

Btw: It seems to me that you have some good coding skills. There are unfortunately many parts of PHP/SQL that I still yet have to learn - but hey, Im hanging in and trying to learn every day ;-)
 
http://www.phpfusion-tips.dk/
Tyler
this only replaces content... php holds the html, it goes through the handler process and then renders the page. I wasn't paying much attention to your code... I understand what you want but if it is possible - which I think not - then I cannot do it. if you could select all of that and the post msg you could request the string length...

there's a lot of code between them... it probably is possible but I've got no clue on a viable way to sift through all that at once.

I know a little bit. I really pick and choose who to help but if you need something ill surely try to help. sorry I don't have your answer.
Edited by Tyler on 15-03-2012 23:33
 
Jump to Forum:
Similar Threads
Thread Forum Replies Last Post
Cookie question Suspected Bugs and Errors 17 14-05-2013 03:39
dumb question about file pages Content Administration 6 09-04-2013 05:16
Registration Security Question Security Issues & Announcements 10 25-01-2013 16:12
FIXED maincore 7.02.05 trimlink function bug (trapezoid with question mark) Suspected Bugs and Errors 2 21-01-2013 02:14
PHP Question General Discussion 10 14-01-2013 00:24
Official Home of PHP-Fusion uses cookies. Some may already have been set. Read more about our Cookies here.
Please click the button I Consent Cookies to hide this bar and accept our cookies. If you continue to use the site with no action taken, we'll assume that you consent our cookies anyway.
Cookiebar Panel byVenue