Joomla module or component to be render on a blank page - joomla

I have developed a Joomla module that does provides a form, processes its post data, does some calculations and displays the results.
The module includes a button to print the results. I'm currently using JavaScript to open a new window, paste the relevant HTML and open the print dialog.
Instead of JavaScript I would prefer to provide a separate URL for the print view and simply open that in a _blank target. This would make the application work better for people using screen readers or not having JavaScript available.
Is there any way that I can tell Joomla to not render the template along with my module? I was thinking that creating a component fixes that issue, but had to find that components are rendered into the template, too...
BTW: I have Joomla 1.5.22

To achieve what you want you have to add additional tmpl=component query string parameter to the request URL. This will disable template and module rendering.
Your URL will look something like this: index.php?option=com_xxx&view=xxx&tmpl=component
Since you are using Joomla 1.5 you can request index2.php?option=com_xxx&view=xxx and it will only render the component. Joomla 2.5 does not have index2.php so if you plan to migrate in future, don't use this option.
If you are using SEF then adding ?tmpl=component at the end on URL does the trick.
To go a step deeper... in your template directory you have component.php file, that is the file that's being loaded by tmpl param. You can copy component.php to my_component.php, do necessary changes and load your custom component template with index.php?option=com_xxx&view=xxx&tmpl=my_component

The joomla way of doing it would be to set your output to "raw", see this tut:
http://www.katcode.com/displaying-raw-output-in-joomla-by-setting-format-in-the-component/

Related

How to access a specific Joomla File

Within an article in Joomla, I have the following code:
(loadposition file_download)
This line of code loads more code, but I cannot access it from the Articles page. How do I access the loadposition code?
On the web you are always striving to separate content from display. Here you are just setting up the display so that when the page renders items in the file_download position will render. That is the html for whatever is in file_download will be generated dynamically when the user looks at the page in the browser. In the editor you are just creating html. If you save the article and view it in the rendered form (i.e. in the Joomla frontend) you will see that loadposition will do its work of rendering whatever it is that file_download asks it to render. That is loadposition is a way to dynamically include content (which might include text, javascript, whatever) into an article.

AJAX: Django's templates flexibility gone? Update CSS & JS?

Leaving all the header/footer/nav parts of pages untouched,
refreshing only page's content with AJAX,
can't use base template extension's block mechanism to set content-corresponding styles, scripts, page title?
Wonder how to get .css and .js for updated content with AJAX?
In general, you will want to make all of your CSS and JS available in the header templates so that they are available when your dynamic content is loaded. The overhead is slight, and you will be following the "Django way."
Another option is to include inline CSS/JS in your dynamic content, but this approach is not recommended. It leads to messy code and can be difficult to troubleshoot.
Can't use full sentences?
Anyway, I have no idea why you think you need to get CSS and JS for partial pages. A set of HTML elements dynamically inserted via Ajax will simply use the existing CSS associated with the page.

Cannot view joomla component

I've created a joomla component which consists of a html form, and when I try and browse to it:
index.php?option=com_helloworld
I get an error 404, component cannot be found.
I'm following this tutuorial:
http://docs.joomla.org/Developing_a_Model-View-Controller_Component/2.5/Developing_a_Basic_Component
Can anyone please tell me how I can browse to the page?
UPDATE: here is the link to my sample component, its a basic html form.
http://tinyurl.com/d6tj7rz
Many thanks
IIRC, even if a component is not installed correctly, you can still access the code if it's on the server, from my experience. But that may have been a 1.5 thing.
If you don't specify a view in the URL by passing &view=viewname, AND you haven't set a default fallback view, then you can't expect to have anything come up.
For a good example on how to set a default view, look in components/com_contact/controller.php line 38.
Within the main controller's display method:
// Set the default view name and format from the Request.
$vName = $this->input->get('view', 'categories');
$this->input->set('view', $vName);

How we create custom sigup page in phpfox?

PHPfox providing the feature to create custom page from back-end but How can I call register form to custom page? Please provide suggestion.
Thanks in advance.
You can call template files within your own pages. I wrote a demo module that illustrates this, using this you can include the templates that display the form to sign up.
But is there any reason why you wouldn't want to use a custom template (instead of the default one) or CSS for the changes you need?

Including CodeIgniter form in existing page

I would like to include a CodeIgniter comment form in an existing php page. Currently I am including the comment form with
$_SERVER["REQUEST_URI"] = "comment/index2/".$page;
require_once($directoryLevelPrefix . "staff/codeigniter/index.php");
However, when codeigniter loads the view to display the results of the form I lose the content on my original php page which contained the form. I have tried adding a redirect after the form data is added to the database to redirect to my original php page e.g.
redirect($_POST['return'])
But I want to pass some variables, such as 'thank you for your comment', and this causes a headers already sent error.
Alternatives might be to use ajax, but I would like the whole page to refresh when the comment is submitted.
I had a similar need and I just loaded the CodeIgniter form in an iframe. This was to put a contact form on a WordPress page. I went with the iframe because my needs were limited to this one form and I felt it didn't require trying to integrate CodeIgniter and WordPress in any way.
One Pro of this method is that the form can be submitted and load a confirmation page, an error page, or even be a multi-page form and all that navigation takes place inside the iframe so you never leave the page that you are on while using the form. Another Pro is that the form is totally portable.
The Cons of course are anything you might not like about using iframes which could be many things based on your needs and preferences.
That is because CodeIgniter is a framework designed to handle displaying entire web pages. You can't just include it, as it tries to send new headers and everything.
Two solutions:
You may be able to load the codeigniter page as the main page, and just include your original php code like a view file. This depends on how your original php file is set up.
You could possibly use cURL to call the page from your own server, to get the html output as a string, then echo it to your current page. This isn't very efficient though.
As C. Scott Asbach mentioned, you could load the whole page in an iframe. Probably not a good idea though, as far as I'm aware iframes are deprecated and make for messy websites.
Probably best is to just try and avoid using CodeIgniter to display a subform in an existing page :-)

Resources