The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.



Post new topic Reply to topic  [ 17 posts ] 
Author Message
PostPosted: Wed Aug 12, 2009 9:53 am 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Fri Apr 10, 2009 8:13 am
Posts: 99
Location: Brazil
Hi folks, I got a doubt.

Let's suppose I got one article (ID 12) and a link to it like that:
mysite.com/index.php?option=com_content&id=12

I wonder if it would be possible to inform a value in the link and it would be replaced in the article where I've pointed the variables. Let's suposse the link would be something like that:
mysite.com/index.php?option=com_content&id=12&name='Mr. Brow'

So in the article I would have the text like:
bla bla bla bla [name] blabla bla bla bla [name]

and all [name] would be replaced by Mr. Brow that I've informed in the link.

Is there any way to do it? How can I achieve that. A step by step will be appreciated.

_________________
http://www.EsferaDoBem.com.br | http://www.ilucato.com.br


Last edited by lucato on Wed Aug 12, 2009 11:16 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Wed Aug 12, 2009 10:30 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Jul 09, 2009 5:10 pm
Posts: 110
Location: Southsea, UK
You can do this easily with a content plugin.
There is an howto http://docs.joomla.org/How_to_create_a_content_plugin
In the onPrepareContent function you can search for your {tags}
and replace them with the passed in data using JRequest::get* functions
As you can do so much with the plugins, I can't really go into any details.


Top
 Profile  
 
PostPosted: Wed Aug 12, 2009 3:29 pm 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Fri Apr 10, 2009 8:13 am
Posts: 99
Location: Brazil
Hi Sly, thanks for your reply. It's a little complicated for me once I'm not good at programming and so on. So, do you know if there is some module, plug-in that I would do it by activing the plug-in and typying the variables directly into the article?

Cheers.

_________________
http://www.EsferaDoBem.com.br | http://www.ilucato.com.br


Last edited by lucato on Wed Aug 12, 2009 11:17 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Wed Aug 12, 2009 3:48 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Jul 09, 2009 5:10 pm
Posts: 110
Location: Southsea, UK
I don't know if something exactly like that is already available, but I doubt it.
I can probably knock you something up quickly, but can't guarantee it for security, bugs or anything else...
You'll need some understanding of PHP/CSS/HTML to get to grips with Joomla, as nothing works out of the box quite as expected.
Let me know the basic specs, maybe someone else can give some more insight, if not it shouldn't take long to put something together!

Edit for grammar :)


Top
 Profile  
 
PostPosted: Wed Aug 12, 2009 4:52 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Jul 09, 2009 5:10 pm
Posts: 110
Location: Southsea, UK
Here's the simple plugin, have a play!
Simply install the plugin and activate it.
Following your example, if you have &name='Mr. Brow' in your URL, you'd now add in your article
{req_replace}name{/req_replace}
Which should then output Mr. Brow

Good luck with it :)


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
PostPosted: Wed Aug 12, 2009 8:52 pm 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Fri Apr 10, 2009 8:13 am
Posts: 99
Location: Brazil
Hey Sly, wow, that seems exactly what I'm looking for, but unfortunately I didn't get to install your plug-in. It is generating the error below:

* XML Parsing Error at 11:194. Error 4: not well-formed (invalid token)
* Plugin Instalar: No plugin file specified

Any idea or new fixed file?

Thanks a lot for your attention.

_________________
http://www.EsferaDoBem.com.br | http://www.ilucato.com.br


Top
 Profile  
 
PostPosted: Wed Aug 12, 2009 10:32 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Jul 09, 2009 5:10 pm
Posts: 110
Location: Southsea, UK
Here's a new one!
I tried adding some more text to the description on the xml, seemed to break it!
I didn't test after adding as I thought : What could go wrong :D
This one should be good....


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
PostPosted: Wed Aug 12, 2009 11:11 pm 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Fri Apr 10, 2009 8:13 am
Posts: 99
Location: Brazil
Wow, amazing! It worked like a charm! Exactly what I needed. I really appreciated that! You need to add it to the Joomla! Extensions database.
Also you can increase the features on it where from the back end we would set more variables throught some input field for var1, var2, var3... and so on, so I would give these variable names like:

var1 = name
var2 = address
var3 = phone
var4 = whatever_name_I_set_for_the_variable

and so on and use the tags in the article:

{req_replace}name{/req_replace}
{req_replace}address{/req_replace}
{req_replace}phone{/req_replace}
{req_replace}whatever_name_I_set_for_the_variable{/req_replace}

Well, just a suggestion.

Sly, if you add it and need my review, you can count on me. Thanks a lot for your time and effort. I really appreciated that.

If you're a designer/webdesigner or other and need high-resolution images for your projects I can provide you 10 FREE CREDITS to download them once you're not an iStockphoto member yet: http://[no tiny url]/13S99F
Ask me this gift before signing-up if you want to.

Thanks once again for your attention and have a nice week.

_________________
http://www.EsferaDoBem.com.br | http://www.ilucato.com.br


Top
 Profile  
 
PostPosted: Wed Aug 12, 2009 11:22 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Jul 09, 2009 5:10 pm
Posts: 110
Location: Southsea, UK
lucato wrote:
var1 = name
var2 = address
var3 = phone
var4 = whatever_name_I_set_for_the_variable

and so on and use the tags in the article:

{req_replace}name{/req_replace}
{req_replace}address{/req_replace}
{req_replace}phone{/req_replace}
{req_replace}whatever_name_I_set_for_the_variable{/req_replace}


I'm not quite sure what you mean by adding an indirection,as it reads from the URL, so if you've got &name='My Name'&address='MyAddress' etc it will all just work. It's a very simple plugin, so easy to modify :)
I don't know how to add it to the extensions database :| It seems so simple it's hardly worth it!

It didn't take long to put together, glad it's helped you :D


Top
 Profile  
 
PostPosted: Thu Aug 13, 2009 11:01 am 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Fri Apr 10, 2009 8:13 am
Posts: 99
Location: Brazil
SlySmiles wrote:
I don't know how to add it to the extensions database :| It seems so simple it's hardly worth it!
It didn't take long to put together, glad it's helped you :D

- I think you can help the community by posting into the extensions database. Here are some info for it that I've found. I hope that helps:
http://docs.joomla.org/Joomla!_Extensio ... ns_site.3F
http://extensions.joomla.org/rules

SlySmiles wrote:
I'm not quite sure what you mean by adding an indirection,as it reads from the URL, so if you've got &name='My Name'&address='MyAddress' etc it will all just work. It's a very simple plugin, so easy to modify :)

- I see, it do more than I tought. I tought I just got to set one variable, but it is more amazing, I can set a lot of variables and add in the URL link. So, as your example I got to set &name=,&lastname=,&phone=,&whateverIwant=, :0) Really great!!!

Sly, I just still have one big doubt, and I don't know if you can help me also on this one. In my language I use some special characters such as ç, á, é, ã, and etc, but If I type the text this way in the URL, it gives an error in the page. Do you know where I can a find a list with the codes that would be replaced by these. Like, I know that %20 is equal to spacebar, but what codes may I use for these special characters. Do you have any idea/list?

Thank again and have a nice day.

_________________
http://www.EsferaDoBem.com.br | http://www.ilucato.com.br


Top
 Profile  
 
PostPosted: Thu Aug 13, 2009 11:52 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Jul 09, 2009 5:10 pm
Posts: 110
Location: Southsea, UK
I'm not sure about the details, but I believe there you can 'escape' the characters, see http://www.blooberry.com/indexdot/html/ ... coding.htm
I don't know joomla enough to find out to encode/decode these, or if JRequest deals with them internally. It's not a problem I've yet had to face.
I'd suggest a new post asking about this specific, and I suppose it will be just 1 extra line of code to make the plugin work correctly if it doesn't already.


Top
 Profile  
 
PostPosted: Thu Aug 13, 2009 12:35 pm 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Fri Apr 10, 2009 8:13 am
Posts: 99
Location: Brazil
Yup, none codes below are working in the URL:
ã
%E3
&#227;
&atilde;

I think you're right, it will need a extra code line. I'll try to post a new thread.
Thanks a lot for your time and don't forget, if you need those free credits to buy an image to print ang hang in your wall, use in your projects or so on, just let me know. ;0)

Best wishes,
Lucato

_________________
http://www.EsferaDoBem.com.br | http://www.ilucato.com.br


Top
 Profile  
 
PostPosted: Thu Aug 13, 2009 12:50 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Jul 09, 2009 5:10 pm
Posts: 110
Location: Southsea, UK
If you get an answer, let just send me a PM or email, and I can update the plugin. I've added it to my site, and at some point will submit it to the extension directory.
Thanks for the offer for the free credits :D


Top
 Profile  
 
PostPosted: Thu Aug 13, 2009 12:59 pm 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Fri Apr 10, 2009 8:13 am
Posts: 99
Location: Brazil
You're welcome. Thank you.
I'll let you know if I get some feedback. You can follow this new thread too:
viewtopic.php?f=428&t=430193

Cheers,
Lucato

_________________
http://www.EsferaDoBem.com.br | http://www.ilucato.com.br


Top
 Profile  
 
PostPosted: Wed Feb 16, 2011 7:01 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Tue Feb 15, 2011 9:26 am
Posts: 1
Hello Sly,

Since you have created this plugin so I am directly asking you for help.
Your creation is simply amazing and it helped me so far without any issues..but there is an additional help that I am asking for.
Could you tell me a way by which I could use this for changing or adding meta-tags through URL ?
Since Joomla maintains its own way to manage title or meta keywords, I cannot use your plugin to change them. So is there a way around or another plugin with which I can change the metas with still using your plugin?

P.S. - I am a newbie in Joomla and also in coding stuffs.


Thanks in Advance
Albus.


Top
 Profile  
 
PostPosted: Wed Feb 16, 2011 5:39 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Jul 09, 2009 5:10 pm
Posts: 110
Location: Southsea, UK
albus1234 wrote:
Hello Sly,

Could you tell me a way by which I could use this for changing or adding meta-tags through URL ?
Since Joomla maintains its own way to manage title or meta keywords, I cannot use your plugin to change them. So is there a way around or another plugin with which I can change the metas with still using your plugin?
Albus.


I don't think this plugin will be able to handle meta tags as they are handled in the <head> part of the html and are already parsed when this plugin is called. The title is also handled the same way.

You'd need to look for a plugin that can handle the data in the <head> section and replace the plugin code from mine into there. the code itself is very simple so should pose a problem.

btw glad the plugin has helped you.


Top
 Profile  
 
PostPosted: Mon Aug 29, 2011 5:14 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Mon Aug 29, 2011 5:05 pm
Posts: 1
SlySmiles wrote:
Here's a new one!
I tried adding some more text to the description on the xml, seemed to break it!
I didn't test after adding as I thought : What could go wrong :D
This one should be good....


Just a quick post to say, thank you very much. This was just what I was after too. Glad to see that it strips tags too.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ] 



Who is online

Users browsing this forum: Google [Bot] and 46 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group