Hot answers tagged

7

According to my experience: JSON views: I have created components based FoF automatic JSON rendering https://github.com/akeeba/fof In this way, it is straightforward to load /get queries. In spite of this, certain tasks can simply be solved with a simple Controller function. With FoF, in a perfect case, you can call an Url (index.php?option=com_todo&...


6

You can define a class for the Header Title of your view, while creating the toolbar for your view within the view.html.php. Within your "addToolbar()" function, you can call the JToolbarHelper::title() method, and specify a second paramater (string) to define a CSS class to the toolbar title, with a prefix of "icon-". Example: JToolbarHelper::title(JText:...


6

I managed to add options as below JLayoutHelper::render( 'joomla.searchtools.default', array('view' => $this, 'options' => array('filtersHidden' =>$hidden))); If $hidden is set as 0 then the search tools will not be hidden. I set this variable appropriately based on the selected filter values.


6

From joomla 3.0 onwards a layout sharing feature is introduced, using it you can call a layout across views or extensions. It requires creating a layout object and then render the view using that object as: $layout = new JLayoutFile('my_layout', $basePath = JPATH_ROOT .'/components/com_something/layouts'); $html = $layout->render(); this will render the ...


5

You need to specify the document type in the URL call with format=raw. Joomla will then automatically load the view.raw.php file. You don't even need a special controller for that. To create the toolbar button you can use this: $bar = JToolBar::getInstance('toolbar'); $bar->appendButton('Custom', '<button onclick="window.location.href = \'...


5

I agree with Jeremy, you could simply use an <img> tag and insert the filename using PHP. However, if for some reason you want to read the file using PHP, try using readfile(). In addition, you can use getimagesize() to get the correct mime type and insert it dynamically. That way you're not limited to using one file type: $image = JURI::base().DS.'...


5

It is the right way :-) Build your links with JRoute, for example: JRoute::_('index.php?option=com_productman&view=product&product_id=x'); It will automatically append the menu item ID of your list page. I assume you have a menu item for the products view? If not then you have to add a menu type for it. You could also make a menu type for the ...


4

Setting the header and trying to process the image directly is really unnecessary. This will produce the result you're looking for: Your second code block should be as follows $input = JFactory::getApplication()->input; $layout = $input->get('layout'); If (isset($layout) && $layout == 'show image') { $image = JURI::base().'files/images/icon....


4

To start, it would probably be best to go through all of this: http://docs.joomla.org/J2.5:Developing_a_MVC_Component/Developing_a_Basic_Component. It's a lot of information, but it will definitely help answer a lot of your questions. Let's start with the form. There are a few pieces that you can do to get this to point at the controller function: <form ...


4

You do not need a plugin for that. Just override a category view and put your check there. For example for the Blog view override blog.php and around line 60 make your check: if ($item->created_by == JFactory::getUser()->id) : echo $this->loadTemplate('item'); } endif; That is of course just an example, but it shows the power of overriding. ...


4

Method 1: Use the CSS class to make it work the way you describe. Add the class to the menu item (at the page display tab, write it in the "Page Class" field). Example: " special-page" (note the space before the page class, without it it will append it to the component rendered output). I recommend using a class that can be used in more than one situation. ...


4

Try changing your query to the following: $query->select('#__users_2679886', 'name') ->from($db->qN('#__users', '#__users_2679886')) ->where($db->qN('id') . ' = ' . $db->q($value) ->where($db->qN('parent.id') . ' = ' . $user->id); The problem was coming from $db->q(parent.id = $user->id). Other that that, ...


3

There is no easy solution, because bots have different behaviour. I would split them into 4 categories and solution for each: Legitimate crawlers (i.e. Google) - these usually respect robots.txt and as you said, you are not interested in that. Legitimate scrappers (i.e. Facebook) - these usually have the proper user agent, so you can block these based on ...


3

If you don't want content to be publicly accessible then use Joomla's ACL to restrict access, removing access for the default (public) usergroup. If you don't do that, or something similar, then your content is public, people can see it, bots can see it. If you don't want your content viewed by anyone, don't publish it to the world. If you do publish it to ...


3

One method would be to block accesses from crawlers, though this depends on being able to identify them. The following article has some good examples of how to enhance the Joomla security. http://docs.joomla.org/Htaccess_examples_%28security%29 One method is to use the HTTP_REFERER attribute to block access for example to images unless they are loaded ...


3

General solution : For each menu-item, you can choose a template to apply to the linked page, so you can duplicate your template and create your view override in the duplicated template. You can then choose the duplicated template in your menu-item parameters and the override will be effective only for that menu-item. With K2 : For your example, you ...


3

The filter fields will automatically populated if they are listed in your Model's $config['filter_fields'] array in the constructor. For example: public function __construct ($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'id', 'a.id', 'title', 'a.title', ...


3

Probably you just need to add the layout GET parameter to the URL Also you can redirect in the controller using setRedirect() and JRoute. $this->setRedirect(JRoute::_('index.php?option=com_iproperty&view=vtour&layout=default2', false), $msg);


3

I think your view files are missing or view class is named incorrectly (correct is [Prefix]View[Viewname]). If I change the name of administrator/components/com_banners/views/ to /viewx/ I get the following error: An error has occurred. 500 View not found [name, type, prefix]: banners, html, bannersView Switch it back to /views/ - and error goes away.


3

Try removing the blank spaces in fields name and fieldset name attributes <fields name="RouteSettings"> <fieldset name="RouteSettings"> <field name="route_id" type="sql" label="Select a route" description="Select a route previously created in the backend." query="SELECT id AS value, route_name AS route_id FROM #__cddir_routes ...


3

It sounds like you only have one model, rather than the expected one-model-per-view. As such, it is looking for the function in a model related to your singles view, which does not exist. Try passing a second parameter to the get function to confirm the name of the model you want to use, ie $this->vacancy =$this->get('vacancy','vacancies'); (...


3

You can't set a class property to a dynamic value, such as a method call, during declaration like you're attempting. See http://php.net/manual/en/language.oop5.properties.php You would need to set it in your constructor. JLoader::Register('MyComHelperConfig', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/config.php'); class MyComController extends ...


2

Not quite the full answer, BUT someone has already started working on this, though not really a rendering of the search page, more of a menu module, but certainly a very nice start http://www.demo-joomunited.com/tag-transform Very nice component, with demo video showing its full workings


2

Answered my own question upon reviewing the API documentation and playing around with the code. I was able to display a different view by specifying the view type and view class prefixes: class xSomethingController extends JControllerLegacy{ function display(){ $viewsomething = $this->getView('Something', 'html', 'xSomethingView'); $...


2

Have you tried jce editor? I always replace the default with this one and work s fine for me. https://www.joomlacontenteditor.net/


2

It's very easy to create your own search plugin as is fully documented at Creating a search plugin.


2

Insure that there is a matching XML file for the view in the \tmpl folder: <?xml version="1.0" encoding="utf-8"?> <metadata> <layout title="COM_MYCOMPONENT_VIEW_TITLE" option="View"> <message> <![CDATA[COM_MYCOMPONENT_VIEW_DESC]]> </message> </layout> </metadata>


2

Use Joomla's template override, by using this method you can override all Joomla core template styles. For com_content PATH_TO_JOOMLA/components/com_content/views/article/tmpl/default.php to TEMPLATE_NAME/html/com_content/article/default.php If you want to change featured view only.then like below. TEMPLATE_NAME/html/com_content/featured/default.php ...


2

If you follow the standard conventions, edit.php will be used for the form layout that allows you to edit an item, and default.php will be used for viewing an item as well as viewing a list of items. Typically in Joomla, you will see two types of view folders: singular and plural. The plural version (let's call it "articles"), will just have a default.php ...


2

I don't know if you talk about the frontend or backend... if you are in the Joomla! backend you can create a custom toolbar button in your view.html.php $bar = & JToolBar::getInstance('toolbar'); $bar->appendButton( 'Print', 'print32', 'Print', 'index.php?option=com_yourcomponent&view=yourviewname&tmpl=component&print=1' ); The second ...


Only top voted, non community-wiki answers of a minimum length are eligible