Automatically add current url before print instruction in Joomla article - url

I want to manually add a [Print] icon in the position of my choosing in a Joomla 3.6 article. This article will be used as a 'master' which will be copied and renamed on a weekly basis so I would like the reference to the article in the URL to be automatic. Something like this:
<div class="btn-group">Print Preview</div>
I tried using # to reference the current page etc but this meant that the entire content of the page was (all modules, headers, footers, etc) were displayed in the print preview as well as the current article.
Thank you.
p.s. BTW, "Joomla3.6" isn't a valid tag yet so I couldn't add it with my reputation of just 1!

Not sure about your goal to "Manually add a [print] icon".
The normal way:
In the joomla /adminstrator , in the menu under Content->article, in the options on the right, there is a "Show print icon" - option. This will show the print icon for all articles. You might need to style it to suit your need. This can also be configured on a per-menu - basis.
Optionally:
You could override the default output of the article template (More on output overrides here) and add the print icon wherever you need it:
Copy the file /components/com_content/views/article/tmpl/default.php to /templates/yourtemplate/html/com_content/article/default.php
Add the print icon somewhere: <div class="btn-group"><a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid, $this->item->language)); ?>" ... >Print Preview</a></div>
But, you can probably use the first method. Or perhaps just move the current output of the print icon in default.php, using the override method described above.

Related

IPB4 Where custom pages are stored?

Title pretty much tells everything. I'm unable to find where my created "custom page" is stored in Invision Power Board 4. Made it via its acp. Thanks for helping me out with this.
In IPB4 they are stored in the database, in separate tables for blocks and pages.
cms_pages - custom pages
cms_blocks - custom blocks
If you're intrested in modyfing them, refer to block_content and page_content columns. Remember to not include <?php ?> tags for your custom php blocks.
If you're looking to edit your custom html page in your favorite editor and don't copy paste the code in ACP at every update I may suggest a solution.
Create a new directory in FTP in your forum root, for example :
/custom/some_feature/
Create your target file inside :
/custom/some_feature/page.html
Paste this in to your custom page in ACP :
<script>
jQuery(document).ready(function() {
jQuery("#main-container").load( "/custom/some_feature/page.html");
});
</script>
<div id="main-container" style="min-height: 300px;"><div>
That's it, now you can edit your file in the FTP and it will be up to date on the forum.
You can go even further and setup a tool to synchronize your local files with the ftp automatically. If you are on Windows take a look at WinSCP.
For macOS and Linux there should be plenty of solutions as well.
Hope it helps, good luck!

How to change URL names in Umbraco

This is my first time round using Umbraco and I have created Document Types / Pages using the wrong naming format and now this has transpired into my page URL's, for instance /about-page/. How would I go about changing them to /about as I have searched the back-end admin panel and there dose't seem to be an option to change their link to document values.
Would anyone be able to provide a simple code based example using umbracoUrlAlias or umbracoUrlName how I could change this preferably in Razor.
Thanks
Editing #run yards Solution by digbyswift help in comment
Correct Solution:
Create Property on in Document Types which applies to all pages you want to change the URL
Call the name anything you want e.g Page URL and Possibly give it a new tab.
Call the alias umbracoUrlName
Type as text sting
Should not be Mandatory (As when you start replacing .Url with .umbracoUrlAlias within the views it will need to be present)
Tab as Generic
Click Save on top right on the page
Added screenshot for starter kit on Umbraco v7.2.5
Unless I'm very much misunderstanding your issue, you should just be able to change the name of your page and republish. This doesn't need an additional field, just change the value in the "Properties" tab and republish the page. This will automatically change the URL of the page.
You can also create a property called umbracoUrlName using a TextString property editor. If this has a value then it will generate the URL fragment for the page using this value, rather than the page name. This changes the URL for the page, rather than creating an alias, like umbracoUrlAlias.
Solution:
Create property on in Document Types which applies to all pages you want to change the URL
Call the name anything you want e.g Page URL and Possibly give it a new tab.
Call the alias umbracoUrlAlias
Type as text sting
Make it required (As when you start replacing .Url with .umbracoUrlAlias within the views it will need to be present)
Go into all your pages and rename them using the property you just created
Now with your code, say with the navigation where you have used .Url change it to .umbracoUrlAlias and the new URL's will be used.
Note if you don't use .umbracoUrlAlias the links will still be active i.e. they work but they won't be displayed in the address bar as .Url spits out the original ones associated with the page.
You can apply on URL names in web.config:
In section find:
<add key="umbracoUseDirectoryUrls" value="false" />
this will set url names for new created items to name.aspx
If you set this to 'true' then new items will be named like /name/
Additionaly you might want to avoid of Handling some urls by Umbraco pipline, just use this setting - add URLs which must be bypassed:
<add key="umbracoReservedUrls" value="~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd" />

Is there a way to get Sublime Text 2 to autocomplete HTML attributes?

I was wondering if there is a way to get Sublime Text 2 to autocomplete HTML attributes like in Aptana?
Autocomplete is enabled by default when you use "<" and your tag and then hit enter. So if you enter <p and then hit enter it will finish out the tag pair for you... where you will end up with <p></p> and your cursor will be in the middle. You can change this to tab if you prefer by pasting the following into your Preferences -> Settings - User file:
{
"auto_complete_commit_on_tab": true
}
This will override the default value of false for completion on tab. Again that is only if you wish to use tab instead of enter.
Hey you may try https://github.com/agibsonsw/HTMLAttributes or install trought package control package called "HTMLAttributes" ;). Its works for me. For example you type:
<p then press space bar then ctrl+space and you got list of attributes.
You can try to use emmet package. It was made specifically for html&css code completion. For more information you should read the documentation.
I was having the same issue; although I use both plugin packages HTMLAttributes and Emmet, neither one provides the auto-complete functionality I was looking for that's similar to Dreamweaver's.
Solution: I found a package called SublimeCodeIntel that does exactly what I needed.
Example: I code html emails and do a lot of inline CSS. End goal:
<td style="vertical-align:top;">
After installing SublimeCodeIntel, I typed <td style="v and a list of CSS properties starting with "v" displays.
Using my arrow keys, I select vertical-align and press tab to confirm, then type the letter "t" and a list of CSS values now displays.
I select top and then press tab to again confirm my selection.
Note: You can create predefined snippets for Emmet for undefined CSS properties but I wanted something "out of the box" instead of having to a) learn how to create them via the documentation (though I'm sure it's simple), and b) create a snippet each time I came across an undefined CSS property/value like vertical-align.
Hope this helps.

Adding content to static files(pages)

I have several static files(pages), which are basically copies of my website pages source code, with the content changed.
These files support my website, (keeping the same format) in various ways.
For example the menu part is:-
<body>
<div id="menu">
<ul class="level1" id="root">
etc
etc. until
</ul>
</div>
Unfortunately every month or so my menu bar changes and I have to update each static file manually.
As each of my static files have the same menu.
Is it possible to have one menu file which can be updated and have the static files load them automatically.
I plan to have several more static files. So this would be a great help if someone can suggest how to accomplish this.
Oh yes. Use some javascript magic to load the menu bar upon page load and keep it in menu.html.
One solution may be to use a spider (wget --recursive) to download generated pages directly from your application. One command, and you have the full copy of your site. (just add some useful options, like --convert-links, for example).
The other option may be to write an after_filter in your controller, and write the generated content to a file (not always, but for example when you add a parameter ?refresh_copy=1). Maybe just turning on page caching would be suitable? But the problem will be that you will not be able to trigger the controller action so easily.
If you don't want the whole site copied, just add some specific routes or controllers (/mirrorable/...) and run the spider on them, or just access them manually (to trigger saving the content in the files).
I ended up creating one controller without a model.
rails g controller staticpages
I then created a layout file which imported the individual changes to the layout, via a "yield" tied to a "content_for" in the view files(static files(pages) in the "view of staticpages" (for example abbreviations, aboutthissite etc etc).
The rest of the static file loaded with the usual "yield" in the layout. Works a treat. No more updating the menu bar all done automatically.
To get to the correct static file I created a route using:-
match 'static/:static_page_name'=> 'staticpages#show' (or in rails 2.x:-
map.connect 'static/:static_page_name', :controller=> "staticpages", :action=> "show"
"static_page_name" variable accepted anything after "/static/" in the url and passed it to the controller "staticpages" in which I set up a show action containing:-
def show
#static_page_name = params[:static_page_name]
allowed_pages = %w(abbreviations aboutthissite etc, etc,)
if allowed_pages.include?(#static_page_name)
render #static_page_name
else
redirect_to '/' #redirects to homepage if link does not exists
end
end
I then only had to change the links in the website. (e.g.<%= link_to " About This Site ", '/static/aboutthissite' %>)
and viola! its all working.

How to make internal article links in Joomla?

I'm trying to create a link in one Joomla article that points to another article, but can't see how this should be done.
Could you please tell me how to do it?
You can link to it like this:
index.php?option=com_content&view=article&id=ARTICLE_ID
Use the JCE Editor. Then follow these steps.
Select the 'link' option
Select browse/content
Select the content item
Select 'insert'.
This is one method, but there are many others. The example uses Joomla 2.5 but the same process is used in Joomla 3.0.
To create internal linking between different div or p just create links like this
Go to div one
Note: must add full URL of current article and then add #name.
<div><a name="div1">Here is div one</a></div>

Resources