My joomla version is 2.5, not sure if this happens with Joomla 3 too.
I have these 2 lines of HTML generated in the page where I have a "category blog":
<link href="/blog?format=feed&type=rss" rel="alternate" type="application/rss+xml" title="RSS 2.0">
<link href="/blog?format=feed&type=atom" rel="alternate" type="application/atom+xml" title="Atom 1.0">
Now, these lines can be disabled by going to Menus > menu item name > advanced parameters > Show a Feed Link - No.
However, there is no option to disable just ONE of them (preferably Atom). This is what i'm looking for! I've found many tutorials that explain how to disable both of them.
Any ideas on how to disable just one of the two?
If you want to remove only of them(Atom feed) then it includes two cases:
1) To remove it from the core library file which is under
test_joomla/libraries/joomla/document/feed/renderer/atom.php
This file includes the feed line in the header , but this is not a preferred one as your about to change the core files if in future if you update you version then you need redo the changes again.
2) To remove the jhead from template file, this one is main line which includes the mootools js , css and feeds in the header.Once you remove those then you need to include them manually in your template file but that's a hectic one.
Hope this one helps you.
You can remove those feeds from your template's index.php:
$this->_links = array(); // To remove both feeds
array_splice($this->_links, 0, 1); // To remove only RSS Feed
array_splice($this->_links, 1); // To remove only Atom Feed
To Remove Both or any one of them here is the article by which you can disable or enable feed and atom i n Joomla.
Reference Url : http://www.host1plus.com/tutorials/cms-tutorials/joomla/other-joomla/how-to-turn-off-rss-atom-feeds-in-joomla-2-5/
You can also use the same way to disable/enable in Joomla 3 as well.
Hope this will help you.
Ok thanks to Amruth Rao, here's how I did it:
In this file around line 105:
/libraries/joomla/document/html/renderer/head.php
change from:
foreach ($document->_links as $link => $linkAtrr)
{
$buffer .= $tab . '<link href="' . $link . '" ' . $linkAtrr['relType'] . '="' . $linkAtrr['relation'] . '"';
if ($temp = JArrayHelper::toString($linkAtrr['attribs']))
{
$buffer .= ' ' . $temp;
}
$buffer .= ' />' . $lnEnd;
}
to:
$buffer .= '<link href="/blog?format=feed&type=rss" rel="alternate" type="application/rss+xml" title="RSS 2.0">';
$buffer .= '<link href="/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon">';
or if you want to keep atom instead:
$buffer .= '<link href="/blog?format=feed&type=atom" rel="alternate" type="application/atom+xml" title="Atom 1.0">';
$buffer .= '<link href="/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon">';
Take care though, the Joomla installation on which i tried it, was heavily customized, so perhaps you need to include more declarations inside the $buffer variable.
Unfortunately you will have to make these changes each time you update your Joomla, but this is the easiest way I've found to do this.
Related
I',m using Laravel 5.5 to create a PDF file using barryvdh/laravel-snappy.
I want to generate a PDF with and extra page without header and footer. It is to print terms and conditions at the end of my budget.
I can generate the first 2 page with the products , price, header , footer... but when I add the terms and contiditons I have the footer and header and the pdf options ( marging...)
I have tried to remove header and footer using javascript when I loadView removing header and footer with css but I have a white space in those places but I need all the page.
$presupuesto = ExpedientePresupuesto::findOrFail($id_presupuesto);
$now = Carbon::now('Europe/Madrid');
$header = \View::make('expedientes.pdf.cabeceraPresupuesto', compact('now', 'request', 'presupuesto') )->render();
$footerHTML = Footer::footerHtml($now);
$footer = \View::make('expedientes.pdf.piePresupuesto', compact( 'footerHTML', 'request', 'presupuesto') )->render();
$pdf= \PDF::loadView('expedientes.pdf.cuerpoPresupuesto', compact('presupuesto', 'request'));
return view('expedientes.pdf.cabeceraPresupuesto', compact('now', 'presupuesto', 'request'));
$pdf->setPaper('a4');
$pdf->setOption('header-html', $header );
$pdf->setOption('footer-html', $footer );
$pdf->setOption('footer-spacing', 10 );
My question is it possible to add other page with differents optios in the same PDF? I mean, the first part of the PDF has header footer and anything I want and the last part has no header, other spacing...
Somenting like that ( does not working)
$pdf.= \PDF::loadView('expedientes.pdf.terms', compact('presupuesto', 'request'));
$pdf->setPaper('a4');
$pdf->setOption('header-html', '' );
$pdf->setOption('footer-html', '');
$pdf->setOption('footer-spacing', 10 );
return $pdf->stream( $now . '-PresupuestoFP.pdf');
I am getting data through Ajax call. That data has following code that stores some value from PHP to Javascript variables using .data(). I am pretty sure php variable has valuesbut values does not get stored in js. Take a look
So there is ajax method
'#ajax' => array(
'callback' => 'a_e_get_score',
It calls the function that has js code
$out .= '
<script type="text/javascript">
jQuery("#chkso").data("paragraphs",' . json_encode($this->result->data->analysis->so->paragraphs) . ');
jQuery("#chkso").data("domExpression",' . json_encode($this->result->data->analysis->so->paragraphDOM) . ');
jQuery("#chkso").data("tooSimpleColor",' . json_encode($light_blue) . ');
jQuery("#chkso").data("tooComplexColor",' . json_encode($light_orange) . ');
</script>';
return $out;
Now when I try to run
$("#chkso").data('paragraphs');
it says undefined.
How do I really pass these values ? I know there is another way mentioned here but that does not seems to work for me as well.
Please guide
If you use the drupal_add_js() function.
drupal_add_js(array('myModule' => array('key' => 'value')), 'setting');
then in your javascript file you can access your value like this:
Drupal.settings.myModule.key
If you want to send data to javascript from your module file only, you don't need to use this
'#ajax' => array(
'callback' => 'a_e_get_score',
Thank all for the help. drupal_json_encode did the trick for me. Following code works with no problem.
$out .= '<script type="text/javascript">
var tooSimpleColor = ' . drupal_json_encode($light_blue) . ';
var tooComplexColor = ' . drupal_json_encode($light_orange) . ';
var domExpression = ' . drupal_json_encode($this->result->data->analysis->so->paragraphDOM) . ';
var paragraphs = ' . drupal_json_encode($this->result->data->analysis->so->paragraphs) . ';
</script>';
Regards,
Is there a way to adjust the size of gorcery CRUD's list thumbnails?
The way it is now it's just silly big, and breaks the table flow.
If possible, it would be nice to have a PHP solution or grocery CRUD setting for this; if not - a CSS rule would be ok, I guess.
Same issue I came across, I'm sure it's a quick-and-dirty solution but it worked for me.
Open your application/library/Grocery_CRUD.php
Download timthumb from here
Place timthumb.php in Root directory (in same directory
level cache folder should be there)
Find function change_list_value
Find around line number 333 in Grocery_CRUD.php
$file_url_anchor .= 'class="image-thumbnail">';
Replace with... following
$file_url_anchor .= ' class="image-thumbnail"><img src="' . base_url('timthumb.php') . '?src=' . $file_url . '&w=100&h=100&zc=3' .'" height="50px">';
Again Find function get_upload_file_input
Find around line number 2545 in Grocery_CRUD.php
$input .= $is_image ? " $image_class'>" : "' target='_blank'>$value";
Replace with following
$input .= $is_image ? " $image_class'><img src='".base_url('timthumb.php') . '?src=' . $file_url . '&w=100&h=100&zc=3'."' height='50px'>" : "' target='_blank'>$value";
Hope this would help you to get rid of ugly size in your list as well as add/edit forms
I know this issue has been discussed in different questions but the answers people have given don't seem to work on my end. I'm dealing with the following problem:
if ( (preg_match($suspect, $lowmsg) )
|| (preg_match($suspect, strtolower($_POST['name'])))
|| (preg_match($suspect, strtolower($_POST['email']))))
Now, people have been saying that if I put "/" in front and behind quotes like so '/email/' that this would solve the problem. I tried putting the / for email and name but it still brought me back to the same delimiter error.
I also get a final error of: Warning: Cannot modify header information - headers already sent by (my website's send.php:43) on line 61. Does this have anything to do with it or is this just an error as a result of the earlier error?
Here's the entire code for interested parties:
<?php
if(($_POST['email']=="")||($_POST['name']=="")||($_POST['message']==""))
{
echo "<html><body><p>The following fields are <strong>required</strong>.</p><ul>";
if($_POST['name'] == ""){ echo "<li>Name</li>"; }
if($_POST['email'] == ""){ echo "<li>Email</li>"; }
if($_POST['message'] == ""){ echo "<li>Message</li>"; }
echo "</ul><p>Please use your browser's back button to complete the form.</p></body></html>";
}
else
{
$message = "";
$message .= "Name: " . htmlspecialchars($_POST['name'], ENT_QUOTES) . "<br>\n";
$message .= "Email: " . htmlspecialchars($_POST['email'], ENT_QUOTES) . "<br>\n";
$message .= "Message: " . htmlspecialchars($_POST['message'], ENT_QUOTES) . "<br>\n";
$subject = htmlspecialchars($_POST['subject'], ENT_QUOTES);
$pagelink = htmlspecialchars($_POST['pagelink'], ENT_QUOTES);
$repemail = htmlspecialchars($_POST['repemail'], ENT_QUOTES);
$injection_strings = array ( "content-type:","charset=","mime-version:","multipart/mixed","bcc:","cc:");
foreach($injection_strings as $suspect)
{
if((preg_match($suspect, $lowmsg)) || (preg_match($suspect, strtolower($_POST['/name/']))) || (preg_match($suspect, strtolower($_POST['/email/']))))
{
die ( 'Illegal Input. Go back and try again. Your message has not been sent.' );
}
}
$headers = "MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: \"" . $_POST['/name/'] . "\" <" . $_POST['/email/'] . ">\r\n";
$headers .= "Reply-To: " . $_POST['/email/'] . "\r\n\r\n";
mail($repemail, $subject, $message, $headers);
header("Location: " . $pagelink . "");
}
?>
You can try other delimiters, such as / # ~
see regexp.reference.delimiters
Hope that helps.
EDIT: you do not need to do backslash inside $_POST
Use $_POST['name'] instead of $_POST['/name/']
EDIT: try
preg_match("/".$suspect."/i", strtolower($_POST['name']);
However, I dont think you would find any of your $injection_strings inside post name. You may need to rethink how you are searching. "content_type" is not going to match "text/html" with your current statement. You'd need to try other regex like
preg_match("/".$suspect."(.*)/i", strtolower($_POST['name'], $output);
So that it would $output[0], your "suspect" variable. I'm not sure if thats what you are looking for, but maybe sending you to the right track.
EDIT: Here.
If you want to look at say "cc:" and find what email it is, use this.
preg_match("/cc:(.*)/i",'cc:'.$_POST['email'],$output);
$output[0]; would equal your email.
To be compatible with your foreach loop, you may want to change it too,
switch this below code within your "if statements"
preg_match("/".$suspect."(.*)/i",$suspect.$_POST['email'])
I'm having problem in adding category description to top navigation. I'm using custom extension magento extension (got it from http://web-experiment.info/webandpeople-custom-menu-extension.html)
So far i went to navigation.php file and changed
$html.= '<a class="itemMenuName level' . $level . $active . '" href="' . $this->getCategoryUrl($child) . '"><span>' . $name . ' </span></a>' ;
To
$html.= '<a class="itemMenuName level' . $level . $active . '" href="' . $this->getCategoryUrl($child) . '"><span>' . $name . $description . ' </span></a>' ;
but still i'm getting only category name.
You can get the complete code in http://puck.ro/Navigation.txt
I thought this is not the right way of doing this!!
Did anyone tell me the exact way of doing this?
Thanks in advance.
I used this to grab the descriptions
$category_data =Mage::getModel('catalog/category')->load($id);
$category_data_des = $category_data->getDescription();
then just added in the loop like so
$html[] = '<span>'.$category_data_des.'</span>';