Welcome, Guest
Username: Password: Remember me

TOPIC: Help (for a beginner coder)?

Help (for a beginner coder)? 12 Sep 2012 06:11 #3533

  • geoffr
  • geoffr's Avatar
  • Offline
  • Senior Member
  • Posts: 68
  • Thank you received: 2
  • Karma: 0
No doubt a no-brainer for some, but I'm having trouble deciphering how the Joomla code creates its urls from the data. The following code:
echo JDom::_('html.fly', array(
					'dataKey' => '_tool_id_code',
					'dataObject' => $row,									
					'route' => array('view' => 'toolsitem','layout' => 'tool','cid[]' => $row->tool_id)
					));

simply displays:
RAPP
which has a link embedded in it.

How do I echo ONLY the word "rapp" without the link?

Thanks,
Geoff
The administrator has disabled public write access.

Re: Help (for a beginner coder)? 12 Sep 2012 18:06 #3540

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
It's a jDom thing.
The "route" part of the code creates the url, so maybe you should try to remove it and have something like that :
echo JDom::_('html.fly', array(
					'dataKey' => '_tool_id_code',
					'dataObject' => $row
					));
Tell me if it did solve it.
Anyway, isn't it something you could solve within the builder or with acl ? (i don't really know what you're trying to do, but it's worth checking it out.
The administrator has disabled public write access.
The following user(s) said Thank You: admin

Re: Help (for a beginner coder)? 12 Sep 2012 21:05 #3554

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Good catch, JDom feature to link properly.

Another good stuff, not a lot of people know (No docs ...)
'dataKey' => '<%name%> <%surname%> : phone <%phone%> '

Replace with your custom keys (leave the tag bounds <%..%> ) and see the result !!
Coding is now a piece of cake
Last Edit: 12 Sep 2012 21:05 by admin.
The administrator has disabled public write access.
The following user(s) said Thank You: JoomGuy

Re: Help (for a beginner coder)? 14 Sep 2012 02:06 #3584

  • geoffr
  • geoffr's Avatar
  • Offline
  • Senior Member
  • Posts: 68
  • Thank you received: 2
  • Karma: 0
Thanks for the answers. The above code looks handy, but how do I use it?

I tried this ...
echo JDom::_('html.fly', array( 'dataKey' => '<%name%> <%surname%> : phone <%phone%> '));

But it returned nothing.

Thanks,
Geoff
The administrator has disabled public write access.

Re: Help (for a beginner coder)? 15 Sep 2012 13:05 #3658

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
echo JDom::_('html.fly', array(
					'dataKey' => '<%name%> <%surname%> : phone <%phone%> '
					'dataObject' => $row
					));
BUT, do not copy/paste this code, you must understand it first.

It will return the values of $row->name, $row->surname, $row->phone, so these properties must exists for this example
Coding is now a piece of cake
The administrator has disabled public write access.

Re: Help (for a beginner coder)? 15 Sep 2012 18:16 #3663

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
To push the explanation further, notice the <%xxx%> represent a row of your table and the rest is just text added between those values.
So what you put between <% and %> depends on what datatypes you added in the TABLES section of your project in the builder.
Admin, correct me if I'm wrong, but the only drawback of this method is the " : phone" you have there in your example (the text added between the values) can't be translated through language files, so you should be cautious about this.
The administrator has disabled public write access.
The following user(s) said Thank You: admin, JoomGuy

Re: Help (for a beginner coder)? 19 Sep 2012 10:12 #3764

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
<%xxx%> represent a field, not a row, but what you explain is right.

About the languages, you can write this string (with markers) in your language file.
It becomes complex to read the source, but really opened !!!
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: JoomGuy
Time to create page: 0.093 seconds

Get Started