Re: [jgen] Problem with $params->get

48 views
Skip to first unread message

Rob Poort

unread,
Oct 11, 2012, 4:13:31 PM10/11/12
to joomla-de...@googlegroups.com
Where do you declare $params?

2012/10/11 Atlantes <ravanb...@gmail.com>
Today I made my first Joomla module but I'm having a problem with parameters.

part of the xml file looks like this:

<config>
         <fields name="params">
                   <fieldset name="basic">
                           <field name="jomsocialFieldId" type="text" default="0" label="ID" description="id of the streams list" filter="integer" />
                   </fieldset>
         </fields>
</config>


and part of my tmpl/default.php looks like this:

echo $params->get('jomsocialFieldId');


When I go to the module in the backend i see the field ID. I can also enter a number there, save it and when I manually search it in the database it is existing.

But the default.php can't get the field data. the echo just shows nothing. Someone knows what I'm doing wrong?

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/NoxtPpoua7kJ.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.


Atlantes

unread,
Oct 11, 2012, 4:22:30 PM10/11/12
to joomla-de...@googlegroups.com
I think not..

I used those 2 tutorials:
http://docs.joomla.org/User:Rvsjoen/tutorial/Developing_a_Module/Part_03
and
http://www.techguywebsolutions.com/create-a-custom-joomla-2.5-module.html

and both only talk about adding the data to the xml and then you can get the data with $params->get()

Op donderdag 11 oktober 2012 22:13:34 UTC+2 schreef Rob Poort het volgende:
2012/10/11 Atlantes <ravanb...@gmail.com>
To unsubscribe from this group, send email to joomla-dev-general+unsub...@googlegroups.com.

Rob Poort

unread,
Oct 11, 2012, 4:30:02 PM10/11/12
to joomla-de...@googlegroups.com
what does it say when you put var_dump($params->get('jomsocialFieldId')) in your default.php?

2012/10/11 Atlantes <ravanb...@gmail.com>
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/2xZzmXJBSSwJ.

To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
Message has been deleted

Rob Poort

unread,
Oct 11, 2012, 4:34:18 PM10/11/12
to joomla-de...@googlegroups.com
and what if you put that line in your main file? (modulename.php)?

2012/10/11 Atlantes <ravanb...@gmail.com>
NULL

Op donderdag 11 oktober 2012 22:30:07 UTC+2 schreef Rob Poort het volgende:
2012/10/11 Atlantes <ravanb...@gmail.com>

2012/10/11 Atlantes <ravanb...@gmail.com>

To unsubscribe from this group, send email to joomla-dev-general+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/2xZzmXJBSSwJ.

To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-general+unsub...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/6H7-BXh0GyoJ.

Atlantes

unread,
Oct 11, 2012, 4:35:23 PM10/11/12
to joomla-de...@googlegroups.com
NULL

the record in the database says: {"jomsocialFieldId":"19"} so it does get saved. There is just no link between $params->get() and the xml/db.

Op donderdag 11 oktober 2012 22:30:07 UTC+2 schreef Rob Poort het volgende:
2012/10/11 Atlantes <ravanb...@gmail.com>
2012/10/11 Atlantes <ravanb...@gmail.com>

To unsubscribe from this group, send email to joomla-dev-general+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.

Rob Poort

unread,
Oct 11, 2012, 4:38:55 PM10/11/12
to joomla-de...@googlegroups.com
could you send or show me the files?

2012/10/11 Atlantes <ravanb...@gmail.com>
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/MCqsXDfQzqQJ.

To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.

Atlantes

unread,
Oct 11, 2012, 4:42:01 PM10/11/12
to joomla-de...@googlegroups.com
And here they are.

Op donderdag 11 oktober 2012 22:39:04 UTC+2 schreef Rob Poort het volgende:
2012/10/11 Atlantes <ravanb...@gmail.com>
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/MCqsXDfQzqQJ.

To post to this group, send an email to joomla-de...@googlegroups.com.
mod_streams.zip

Rob Poort

unread,
Oct 11, 2012, 4:58:57 PM10/11/12
to joomla-de...@googlegroups.com
How do you install your db table? I first got an 500 error, caused by a missing table. As soon as I manually inserted a table (with a row `field_id` and a row `value`), the echo and var_dump work fine

2012/10/11 Atlantes <ravanb...@gmail.com>
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/f-axim-pYHUJ.

To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
Message has been deleted

Atlantes

unread,
Oct 11, 2012, 5:09:16 PM10/11/12
to joomla-de...@googlegroups.com
It uses a table created by the component JomSocial. When I don't use the parameters but just use 19 in the query it also works fine.

I did loaded the module using {loadmodule streams} inside an article.

The problem is that the module is not assigned to a page (menu) (because i use an article to include the module). When i assign it to for example Home it does work.

Op donderdag 11 oktober 2012 22:59:03 UTC+2 schreef Rob Poort het volgende:
2012/10/11 Atlantes <ravanb...@gmail.com>
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/f-axim-pYHUJ.

To post to this group, send an email to joomla-de...@googlegroups.com.

Rob Poort

unread,
Oct 11, 2012, 5:09:16 PM10/11/12
to joomla-de...@googlegroups.com
No, I've tested that, and it still works fine here. Do you have your error-reporting on? Does it give any errors?

2012/10/11 Atlantes <ravanb...@gmail.com>
It uses a table created by the component JomSocial. When I don't use the parameters but just use 19 in the query it also works fine.

I did loaded the module using {loadmodule streams} inside an article. Can that cause problems?

Op donderdag 11 oktober 2012 22:59:03 UTC+2 schreef Rob Poort het volgende:
2012/10/11 Atlantes <ravanb...@gmail.com>

To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/f-axim-pYHUJ.

To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-general+unsub...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/EsU5DrIrb5wJ.

Atlantes

unread,
Oct 11, 2012, 5:13:02 PM10/11/12
to joomla-de...@googlegroups.com
Problem was that it wasn't assign to a page (menu). When i publish it to all pages it works perfectly. I think this is a fine solution. Thank you for the help.

Op donderdag 11 oktober 2012 23:09:19 UTC+2 schreef Rob Poort het volgende:
2012/10/11 Atlantes <ravanb...@gmail.com>
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/EsU5DrIrb5wJ.

To post to this group, send an email to joomla-de...@googlegroups.com.

Rob Poort

unread,
Oct 11, 2012, 5:21:50 PM10/11/12
to joomla-de...@googlegroups.com
I didn't know about this behaviour, Nice to know it for the future. Somehow the module's params get overwritten bij the article's. Perhaps you could make an hidden menu item where you also publish the module

2012/10/11 Atlantes <ravanb...@gmail.com>
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/yEBA2XYs_kkJ.

To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages