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
Related
i want to query whereBetween two dates with time
here is code which is working fine
whereBetween('created_at', [now()->subDay()->format('Y-m-d') . ' ' . $tgame->start_time->format('H:i:s'), now()->format('Y-m-d') . ' ' . $tgame->end_time->format('H:i:s')]
but this code is not working
$date = Carbon::parse($request->date);
whereBetween('created_at', [$date->subDay()->format('Y-m-d') . ' ' . $tgame->start_time->format('H:i:s'), $date->format('Y-m-d') . ' ' . $tgame->end_time->format('H:i:s')]
please also explain thank you
Calling subDay() on the $date object will set the time in the Carbon object back 24 hours. So in the upper boundary for whereBetween, you are not using the request date, but the one 24 hours back.
To achieve what you want, you need to copy the object before changing it:
...->whereBetween('created_at', [$date->copy()->subDay()->format('Y-m-d') . ' ' . $tgame->start_time->format('H:i:s'), $date->format('Y-m-d') . ' ' . $tgame->end_time->format('H:i:s')]
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.
Ive got the error below
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in C:\xampp\htdocs\suitecrm\include\Smarty\Smarty_Compiler.class.php on line 268
I have changed the PHP.ini file to stop showing deprecated errors, but it still shows up
error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT
I've also changed the line in the Smarty_Compiler.class
$source_content = preg_replace_callback($search, create_function ('$matches', "return '"
. $this->_quote_replace($this->left_delimiter) . 'php'
. "' . str_repeat(\"\n\", substr_count('\$matches[1]', \"\n\")) .'"
. $this->_quote_replace($this->right_delimiter)
. "';")
, $source_content);
But its not working..
Please advise
I found that and it seems working:
Replace lines from line 262 with:
/* replace special blocks by "{php}" */
$source_content = preg_replace_callback($search,
function($m) {
return "{php ".str_repeat("\n", substr_count($m[0], "\n"))."}";
},
$source_content);
I have resolved this issue by replacing the code in include/Smarty/Smarty_Compiler.class.php file. I replaced the code on line numbers from 262 to 268 with the below mentioned code. After that delete all the files which are in the cache folder and reload the page. This issue will be resolved.
/* replace special blocks by "{php}" */
$source_content = preg_replace_callback($search, create_function ('$matches', "return '"
. $this->_quote_replace($this->left_delimiter) . 'php'
. "' . str_repeat(\"\n\", substr_count('\$matches[1]', \"\n\")) .'"
. $this->_quote_replace($this->right_delimiter)
. "';")
, $source_content);
My solution:
$source_content = preg_replace_callback($search,
function($m) {
return $this->_quote_replace($this->left_delimiter) .
"php ".str_repeat("\n", substr_count($m[0], "\n")) .
$this->_quote_replace($this->right_delimiter);
},
$source_content);
In solution from Axel De Acetis I miss using of function $this->_quote_replace.
In solution from Sandeep Shivhare I dont like the number 1 in $matches[1], it references wrong string.
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>';