Joomla article with custom buttons and images on the right - html

I have to create Joomla website. I am PHP programmer, but new to Joomla.
I have spent a lot, reading tutorials and other staff.
The website is very simple, it is visit card for restaurant.
I have installed Joomla 2.5. Spending two days I have managed to do the following:
- create menu
- create multi language site (2 languages) with language swicher
- create simple static pages (articles)
- create one page as contact
- create simple template just for my website
However, I cannot do some things and I have not found any answers in tutorials or google.
If you open this file http://img1.uploadscreenshot.com/images/orig/1/2621034793-orig.jpg you can see images with three different pages on the site:
1) Article with three images on the right.
Basically, I do not know what is the best practice to create article with some custom HTML in it (in this case these are images). For example, i can create table with two columns - one for text, another for images. Without Joomla I would create two divs, but how this can be done here??? Also with custom html I need to do the same for each language - I need to add images for each language, I do not like this. I really have not found any solutions for this. Do you have some suggestions?
2) Article with three buttons on the right side. This is article on landing page.
This is probably the same question - how to create article with some custom HTML in it (in this case these are three buttons - links to pages inside the website)? Again I can create table with text and buttons, but this should be done for each language. Is it a good practice? Do you have some other suggestions to create article with three buttons on the right side? Maybe I can create some custom module, but this sounds strange.
3) Contact page with google map.
I have create contact page with contact details. This is another question, I would ask other time.

Hello Renathy and welcome to Joomla!
1) You can of course insert divs in the editor and style them with floats; but as you mention this is pretty bad for translation, and allows the user to easily break the layout.
You have the following options:
1.a)
Joomla 2.5+ supports an article image and thumbnail that you can specify in the Images and Links group for each article. Quite some work to extend to 3 images, you would need to write a plugin (or do a nasty core hack) and override the view; also it's not well documented. There is a discussion here about it: Add additional images to articles in Joomla 2.5
1.b)
Add the extra images as above with the plugin. Then use a module for displaying the images instead of the view override.
1.c)
Use a custom image management solution to link images to an article, then a plugin to display them. Easier, but still a lot of work. I have done this on one site and worked fine, although I would change a lot of code now. As far as I know there are no extensions available that will do this.
All three solutions allow you to use proper floating of the contents using divs floats responsive as appropriate, and will isolate the layout of the content from the images, thus obtaining a solid environment for the content editors, and easy translation (although, if you go with 1.a) or 1.b), I strongly advise you to use a proper translation suite such as Falang or JoomFish (Falang is a different port of Joomfish from the old 1.5 version)
2)
You will address this as above, with a module.
Create in your template a main
<div class="content-box">
<div class="content-main"> here you will place your component's output.</div>
<div class="content-sidebar"> here you will output a new module position, name it "article-sidebar"</div>
Then style it like this:
div.content-box {
/* here you need a clearfix choose one here: https://stackoverflow.com/questions/211383/which-method-of-clearfix-is-best/211467#211467 */
}
div.content-box div.content-main {
width:70%;display:inline-block;float:left;
}
div.content-box div.content-sidebar {
width:29.99%;float:right;
}
div.content-wide div.content-sidebar {
display:none;
}
But you may not want this on all pages, then you can deal with it programmatically when generating the template.
The idea is: in your template output, where you are writing
<div class="content-box">
instead add a class conditionally when your article-sidebar contains something:
<div class="content-<?php
if ($this->countModules("article-sidebar")==0)
echo "wide";
else
echo "box";
?>">
This will dinamically change the class of the div, so you only serve 1 css.
At this point, create a module and choose to display it "Only on selected pages" .
3)
When you want to change a view, never change the file in place. Instead copy all the view's php to a folder under your template's folder / html/com_contact/contact. Even if you're changing a different layout, you will still need to copy there the default.php.
Then change it inserting the google maps.
A final consideration. You should refrain from editing core files. Joomla sometimes issues security updates, and applying them will be painful. Good luck with your site.

Related

WordPress - enable/disable a div like a widget

I am building a custom WordPress site with my own theme. Is there a way in WordPress that would allow me to enable or disable a div in the sidebar similar to the way I enable or disable a widget?
For example, I have a div that is for a newsletter subscription form and a div that is for a call-to-action button. Is there a way that I can allow the WordPress administrator to choose which page to have the newsletter subscription form and which page to have the call-to-action button dynamically?
I have been searching but was unable to find any information. Perhaps I didn't have the right keyword?
Any suggestion would be greatly appreciated. Thanks!
For that to happen you would either have to go for the somewhat tricky solution, but on the other hand more satisfactory; create a custom options page with a true/false-solution using the Settings API. You can read more about that over at Codex here: https://codex.wordpress.org/Settings_API . They here refer to a handfull of external resources to learn more. This guide helped me when setting up my first built-from-scratch page; http://ottopress.com/2009/wordpress-settings-api-tutorial/ .
The other solution would be to use a plugin. The top shelf, best in class solution - if you ask me - would be Advanced Custom Fields; http://www.advancedcustomfields.com/ . It's a little bit of work to first get it's head around, perhaps, but when you get going you'll probably never look back. Creating awesome options pages is a breeze, and you probably will end up making all sorts of elements on your page optional - just because you can. But there's a catch; to create options pages you will have to buy the Pro version of it.

Overriding layouts in RefineryCMS

I have just started working with ruby on rails properly like for a week and now I have started working on RefineryCMS, I followed the official guide and created a demo application and got to know the interface and the CMS itself a little bit, now I am trying to create a proper site using RefineryCMS. The first thing I wanted to do was to change the appearance of the default homepage, hence I override it and added my own HTML that I have and replaced the default layout that worked fine to some extent. Now the problem is I had style sheet associated with my HTML, as I am new to this CMS I cannot find a way to properly link my style sheets/ override my style sheets associated with the home page. I have followed the official documentation but was unable to get through the idea of how to override the stylesheets, I have followed other various links as well.
Can someone please guide me to a tutorial where there is a stepwise explanation regarding how to do that, or even better a stepwise detailed tutorial for newbies like me to get started with the RefineryCMS, I have spent hours but still have found a proper way, maybe I havent been looking or googling the right question because I am new to this CMS i.e. "How do I properly link my overridden HTML in refineryCMS to its corresponding stylesheets also to the corresponding images and javascript files"
I would really appreciate any sort of help to get me going. Thank you.
Thanks for using Refinery. There are two ways to do this, but really the first one is my preference.
The easy and recommended way, using CSS selectors:
First, check out the getting started guide's section on "styling views".
Now, just create an asset file for the home page, let's call it app/assets/stylesheets/home.css.scss. To that, we can add nested styles under the following ID selector. I've added background: red; so that you can see an immediate result:
body#home-page {
background: red;
}
This is the way that I would recommend adding CSS for templates.
For the non-recommended, complicated way that requires extra assets and adding to the precompile list:
First, see the overriding views guide.
Now, with the refinery/pages/home.html.erb template that you will have, you can link to a stylesheet:
<% content_for :stylesheets, stylesheet_link_tag('home') %>
The stylesheet should now be linked in the <head> section of the page and you should be able to add CSS that just relates to the home page by creating the app/assets/stylesheets/home.css.scss file and applying it in the same way as the first section:
body#home-page {
background: red;
}
Note that because this is in the same directory as the manifest file application.css it will automatically get included for all templates, too, and so this is more complicated. It also requires you to add to the precompile list in config/application.rb:
config.assets.precompile += %w(home.css)

html form to add links and description to page

I've got a simple basic .html document that I'm using for a "My Links.html" local, offline page to use as a way to store hyperlinks to other websites I find interesting. It's kind of like a portable "bookmark" page on the go. Here's some sample code that I've created already:
<b><h3>Web Design Resources</h3></b>
<hr />
<br />
<b><h4><u>CSS Tutorials</u></h4></b>
Line25.com
<ul>
Tutorials
- main tutorials page<br />
Pure CSS Dropdown
- Creating a dropdown menu solely out of css, nothing else (includes sub menus that slide out to the right) <br />
Trendy flat-style-css-menu
- how to create a trendy flat style css menu (hover over "menu image" puts menu title to the right of the images)<br />
Slick Features Comparison Table
- a ghosted (semi transparent) table that vertically compares three items with the categories on the left, box highlight on category font when hovering over any of the text in that row<br />
Simple Collapsing Header Effect
- fixed horizontal menu on top with header text/image that is hidden when scrolling down the page, replaced with the content
Currently I'm manually opening the html document and editing it to add each new link, description and categories (as they come up).
What I'm looking to do is add some simple forms and a submit button to update this offline .html document. I'd like to keep everything contained in the one single document for ease of moving around.
Ideally it'd add text using this format: "hyperlink - description"
With a dropdown of existing categories so that it adds to the correct section. Just a couple text boxes, a dropdown box, and a submit link or button. Nothing fancy, just the bare bones to "get the job done".
Thanks everyone, even if ya can just point me in the right direction or let me know the element names so I can more effectively research what I'm looking to do.
I don't think this will be possible with pure HTML.
You can alter the HTML with Javascript (jQuery) on the client side, but you won't be able to save the changes to your local file system trough Javascript. You can always save the altered document manually if that is an option, but it doesn't seem ideal to me.
For a more solid solution you would need some server side scripting like PHP, and a webserver like Apache running on your local machine (like XAMP or MAMP). And ideally you would need to work with some sort of database or XML file to store the data. Technically it is possible to just alter the HTML but it would be strange and highly uncommon. The XML file will be the easiest for portability, the database will be better for performance (and probably a more useful exercise).
Not sure if this is the best way to handle you 'problem' though. Why not just work with an existing service like Xmarks. You will have access to your bookmarks directly from your browser, can sync them between various machines / browsers, or can access them through their website.
If you are just trying to learn something new however, I encourage the effort. Feel free to ask for any more specific pointers once you decided which route you want to take...

how to create a menu in html dynamically

I'm not sure if I am using the proper term when I refer to "dynamically. *
I want to have a simple, one level, menu displayed on all 80 pages of my site. The menu items will change periodically - new items added, some removed, etc... What is the best way to create this menu so I don't have to update all 80 pages? FYI: I'm not too knowledgeable in all the scripting languages. Thank you.**
The simplest way is to use PHP.
Name all your files so they end in php instead of html, and make a file called menu.php.
Copy your menu into menu.php, then no your other pages where you want the menu, type:
<? include("menu.php"); ?>
and the menu will appear like magic!
I would also suggest SSI, but they are often disabled on shared hosting in my experience.
Create a master page if your working in any one of the "major" web frameworks. You put a lonely HTML tag up there so I'm not sure if this NEEDS to be purely HTML and nothing else.

Orchard CMS - theming

I have some questions regarding theming Orchard CMS. So, let's begin... I have a website that will have 5 pages and some of them have different layouts.
Pages and zones within it:
Homepage - Content, TripelFirst, TripelSecond, TripelThird
Concept and Rentals page - Content, AsideFirst, AsideSecond
Press and Service Department page - Content, AsideFirst, AsideSecond (different layout then the previous two pages)
Note: Even though all of the pages have the Content zone, except Homepage none of the pages uses it. Other pages only have HTML widgets located in one of the zones.
1) I've read that it is possible to create the layout for the specific ID, the problem is I can't find that ID to create the layout for specific ID.
2) As you can see, couple of pages have the same layout, how to assign them to the specific layout? For example, if I create the layout for Concept and Rentals page how can I assign the specific layout to them and also how can I assign the layout to Press and Service Department pages?
3) How to add the class tag to the body? The problem is that Orchard CMS creates the body before everything else so it isn't contained in the layout cshtml files.
Thank you in advance!
when you edit the page in the admin, the url will look something like http://localhost:30320/OrchardLocal/Admin/Contents/Edit/16
16 is the id here.
Several things you can do. Easiest is to use this module: http://orchardproject.net/gallery/List/Modules/Orchard.Module.Downplay.Orchard.LayoutSelector
Alternatively, you could programmatically create alternates based on arbitrary criteria: http://weblogs.asp.net/bleroy/archive/2010/12/14/switching-the-layout-in-orchard-cms.aspx
Finally, you can often avoid to have to create an actual separate layout by just varying what widgets go where, using layers.
The body tag is in document.cshtml, which you can override in your own theme.
1. Not sure what you mean by ID? If you click Widgets on the DashBoard, there are Layers there. A layer is a collection of widgets that will activate for a specific thing, Like the authenticated Layer will display those widgets you define when a user is authenticated.
Expanding on (1) and for (2), you will be able to create a new layout by adding widgets to a layer.
Check out:
Tagged Layer Rule - Allows you to add widgets based on a tag. Now, you can add pages for concepts and rentals and then specify a layer for these tags, within that layer, you can add any widgets you like. These will only appear when that tag is encountered.
Also check out:
Content Type Layer Rule - Haven't tried this, but it falls on the same lines.
3. To customize the look there is something called Shapes. Each Zone I think has a corresponding cshtml files. You can even use the ShaperBuilder to even render html in code, again, don't know too much about this but I can tell you, you need to look into these articles.
Using shapes as Html helpers in Orchard
Using shapes as Html helpers in Orchard
Taking over list rendering in Orchard
Dispatching Orchard shapes to arbitrary zones
HTH, I'll try and contact some orchard folk that are on SO.
So to help you out here
The ID of the Home Page is always 11 for a fresh install though I imagine that you can delete the home page and create a new one and give it another ID. To find the ID of the other pages open up the DB and look at the Content Items.
I know of no way to apply Layouts other than by ID so just duplicate the layout pages as you have so few pages.
I would just use a small jQuery script
$(document).ready(function{
$('body').addClass('SomeClass');
});