ngreenwood6 Posted May 12, 2009 Share Posted May 12, 2009 I am pretty good with php but I am lost trying to figure something out. I am trying to edit a text file. The file has something like this in it: Hello {USERNAME}, No where in this file is <?php. I am used to doing echo $username but this just seems odd to me. How does it get this username? I was thinking that it was calling this file from somewhere but I tried searching through all the source files of my site for that txt files name and came up with nothing. Any help is appreciated. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 12, 2009 Share Posted May 12, 2009 It's a template file. It will be passed through some PHP code to replace that {USERNAME} string with the actual contents. Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted May 12, 2009 Author Share Posted May 12, 2009 Do you know how I can find the file that it will be passed through? Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 12, 2009 Share Posted May 12, 2009 Look for a template class or some template system. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted May 12, 2009 Share Posted May 12, 2009 Is the file in a folder by itself or other such files? Search for the folder name? What method are you using to search through the files? Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted May 12, 2009 Author Share Posted May 12, 2009 Well I am using phpbb and there are nothing but text files in this specific folder. They are the emails and messages that you receive. Basically I am trying to make it so that when the person receives an email it sends them what was posted in the email, because right now it is just showing the link to the post. I am in the language folder so its not in the template. Any ideas? Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted May 12, 2009 Author Share Posted May 12, 2009 oh yeah I was using dreamweaver to search for the text file through source code of the entire sites folder Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 12, 2009 Share Posted May 12, 2009 Well you don't need to find the render for that. Just set a template variable in the PHP and slap it into the template. Just a note - there are many places where phpBB set template variables. Make sure you choose the right place or it won't work. I've had numerous issues when I was getting around phpBB3 for the first time. Good times... Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted May 12, 2009 Author Share Posted May 12, 2009 Well you don't need to find the render for that. Just set a template variable in the PHP and slap it into the template. I am not quite sure what you mean about that? I just want the author and the message to show up when the topic is replied to. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 12, 2009 Share Posted May 12, 2009 What do you mean you want the author and message to show up when the topic is replied to? Doesn't phpBB already do that for you? Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted May 12, 2009 Author Share Posted May 12, 2009 No when an email is sent you only get a link to the forums. I want it to show the person who replied to my message and show what they posted in the email that is sent. Right now it just gives a link to the forum topic so that you can click it and view the topic. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 12, 2009 Share Posted May 12, 2009 Oh okay. Well then yeah, just set the variable and pass it over. Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted May 12, 2009 Author Share Posted May 12, 2009 Oh okay. Well then yeah, just set the variable and pass it over. Thats the part that I am confused about. Where would I pass the variable from and how would I call it on the email page? Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 12, 2009 Share Posted May 12, 2009 You'll have to find the correct PHP page that sets the template variables for the template the sends that specific email. And you would just call it with "{SOME_NAME}" where SOME_NAME is defined as a template variable. The { } around it just lets the template system know that is has to do something with it. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted May 12, 2009 Share Posted May 12, 2009 It's probably just a str_replace() somewhere in the file that's responsible for sending the email. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 12, 2009 Share Posted May 12, 2009 Not sure it's just a str_replace() because the template vars are stored in an associative array. The { } are not in the keys so calling str_replace directly won't work. I guess you can strip away all the { and } and use str_replace(), but I think that would also kill off the {if } statements. Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted May 12, 2009 Author Share Posted May 12, 2009 I think the page that sets the template variables is functions_posting.php. But I dont know what you mean by call it with {SOME_NAME} if it isnt ever set? Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 12, 2009 Share Posted May 12, 2009 Well there are *many* pages that set template variables. You have to find the one that sets the variables for that email template. Forget {SOME_NAME}. Just find the right file, add the new key in the array and in the template, use {key} where key is the key you put in the templates array. Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted May 12, 2009 Author Share Posted May 12, 2009 Ok I have done that. I made an author and a message key. When I send the message the author is displayed but the message is not. I am using: $user->data['username']; //username $data['message']; // message that is posted Am I missing something? Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 12, 2009 Share Posted May 12, 2009 I said in the template array. Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted May 12, 2009 Author Share Posted May 12, 2009 That is where I set them. I was just showing you the code that I put in there. Here is the whole thing: $messenger->assign_vars(array( 'USERNAME' => htmlspecialchars_decode($addr['name']), 'TOPIC_TITLE' => htmlspecialchars_decode($topic_title), 'FORUM_NAME' => htmlspecialchars_decode($forum_name), 'U_FORUM' => generate_board_url() . "/viewforum.$phpEx?f=$forum_id", 'U_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id", 'U_NEWEST_POST' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id&p=$post_id&e=$post_id", 'U_STOP_WATCHING_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?uid={$addr['user_id']}&f=$forum_id&t=$topic_id&unwatch=topic", 'U_STOP_WATCHING_FORUM' => generate_board_url() . "/viewforum.$phpEx?uid={$addr['user_id']}&f=$forum_id&unwatch=forum", 'AUTHOR' => htmlspecialchars_decode($user->data['username']), 'MESSAGETEXT' => htmlspecialchars_decode($data['message']), )); That is showing the author but it is not showing the MESSAGETEXT. I changed it to "hello" instead of the $data['message'] and it showed it. Everywhere through the code it looks like it gets the message by doing $data['message'] but its not showing it Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 12, 2009 Share Posted May 12, 2009 Okay, looks good. You may not be able to use $data['message'] if it doesn't exist there. Find out in the file if anything else is available to get the message. Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted May 12, 2009 Author Share Posted May 12, 2009 I have been looking but am unable to find any information. Any ideas? Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 12, 2009 Share Posted May 12, 2009 Not at the moment. I'm not at home so I don't have access to anything phpBB related. Not to mention the files are on your side. (No, that does not mean you should post them here.) No one will bother looking through all of them especially if they're not familiar with the system. Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted May 12, 2009 Author Share Posted May 12, 2009 I had no intentions of posting the files here. I am drawing a huge blank right now about how to do something. I figured out that the $data was getting passed in through reference for another function in this same file. So I am thinking that because of this it is not available outside of that function. How can I get that data from that function to another function in that file. Quote Link to comment 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.