Fiji Web Design
Welcome, Guest
Please Login or Register.    Lost Password?
Re:help: PHP module - mod_php using str_replace() (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:help: PHP module - mod_php using str_replace()
#1139
admin (Admin)
Admin
Posts: 475
graph
User Online Now Click here to see the profile of this user
Re:help: PHP module - mod_php using str_replace() 2 Years, 1 Month ago Karma: 10  
Only the first 3 lines is needed.

$user =& JFactory::getUser();
$article->text = str_replace('<<username>>', $user->username, $article->text);
$article->text = str_replace('<<user>>', $user->name, $article->text);
The only thing I can think of is the plugin is not published? It is also probably a better choice to use {username} since <username> looks like HTML tags. If you had a plugin that parsed HTML in the content would choke on it.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#1140
jacomstephens (User)
Fresh Boarder
Posts: 6
graphgraph
User Offline Click here to see the profile of this user
Re:help: PHP module - mod_php using str_replace() 2 Years, 1 Month ago Karma: 0  
OK, I got it working now! I changed <<username>> and <<user>> to vusername and vuser and it works. Looks like you were right... the <> was screwing it up. Thank you so much for your help!!!
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#1141
jacomstephens (User)
Fresh Boarder
Posts: 6
graphgraph
User Offline Click here to see the profile of this user
Re:help: PHP module - mod_php using str_replace() 2 Years, 1 Month ago Karma: 0  
Sorry to keep bugging you. I really do appreciate your help. The str_replace is working for just plain text, but when it's inside a {} it kind of works, but not really. I'm trying to call a module YOOgallery and have it show the images for whoever is currently logged in (located in a folder with the same name as the user's username). Here is the code:

{yoogallery src=[clients/--user--/proofs]}
where --user-- gets swapped for the username, but it gives me this error message: Unable to find the source directory (/home/avidcrea/public_html/newavid/clients/toi/proofs/), please check if your source directory exists. It looks like the str_replace worked because it shows the toi instead of --user-- in the path, but why does it add all that source path in the front? It does that even if I use the full URL: http://www.avidcreative.com/newavid/clients/--user--/proofs If I type in the code myself instead of letting the str_replace do it, it works fine.
{yoogallery src=[clients/toi/proofs]}
Do you have any idea why it would be adding that source path at the front of it and if there is a way to avoid that? Again, thank you very much for your help! Also, is there a way to get it to work on a module? For example, I have a module that will list all the files in a certain folder. In the Module Parameters, it asks for a Directory Path and I'd like to be able to use the --username-- str_replace to point the module to the folder of the user who is currently logged in. Is there a way to do that?
 
Report to moderator   Logged Logged  
 
Last Edit: 2009/12/30 16:46 By jacomstephens.
  The administrator has disabled public write access.
#1144
admin (Admin)
Admin
Posts: 475
graph
User Online Now Click here to see the profile of this user
Re:help: PHP module - mod_php using str_replace() 2 Years, 1 Month ago Karma: 10  
The PHP error message will always display the absolute path. If you have Joomla at: /home/avidcrea/public_html/newavid/ and the path is clients/toi/proofs/, then the error would display /home/avidcrea/public_html/newavid/clients/toi/proofs/.

So it isn't adding anything at the beginning. I don't see how it could, unless yoogallery is doing it.

Try turning off yoogallery, then just viewing the resulting code. If it matches what you would type manually, then something else is going wrong.

You would not be able to use this to send parameters to a module. Module parameters only exist in the context of the module. You would have to edit the PHP code of the module to do what you want.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#1145
jacomstephens (User)
Fresh Boarder
Posts: 6
graphgraph
User Offline Click here to see the profile of this user
Re:help: PHP module - mod_php using str_replace() 2 Years, 1 Month ago Karma: 0  
I figured it out (with your help of course)... it was the order of the plugins. I just had to put the PHP script with the str_replace BEFORE the YOOgallery and now it works. Thank you, thank you, thank you! I owe you lunch (or two). That was a good idea about turning off the YOOgallery plugin to see what the code looked like though... I'll remember that for debugging the next thing I run across.

OK, so now on to the next thing: do you know of a plugin (not module) that will do a simple file upload? All I need to do is have each user be able to upload files to their own image folder. It would need to be able to handle large files over 10MB, so a progress bar would be very useful, and it would be nice if they could upload multiple files too. You don't know of something like that do you? I've looked on the Joomla Extensions site and haven't found anything quite right yet.

Thanks again. Is there a way I can donate to your cause as a thank you for all your help?
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#1146
admin (Admin)
Admin
Posts: 475
graph
User Online Now Click here to see the profile of this user
Re:help: PHP module - mod_php using str_replace() 2 Years, 1 Month ago Karma: 10  
I don't know of any plugins that will do file uploads. A component would be more suited.

Each of our open source products has a donate button. http://www.fijiwebdesign.com/products/joomla-php-plugin.html
Any donation is greatly appreciated.
 
Report to moderator   Logged Logged  
 
Last Edit: 2009/12/30 21:53 By admin.
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Joomla Downloads

DownloadsDownload our free Joomla! Components, Modules and Plugins.