I am using Joomla Sef URLs and its working fine except that i need '.htm' suffix instead of '.html', please help.
currently my URLs appear like :
www.mysite.com/my-page.html
I want it to be like
www.mysite.com/my-page.htm
You will want to use one of the 3rd Party Search Engine Friendly link extensions: http://extensions.joomla.org/extensions/site-management/sef
Here is a patch. Tested on my Joomla 1.5.9 (standard bundled SEF):
Index: includes/router.php
===================================================================
--- includes/router.php (revision 13023)
+++ includes/router.php (working copy)
## -57,8 +57,13 ##
{
if($suffix = pathinfo($path, PATHINFO_EXTENSION))
{
- $path = str_replace('.'.$suffix, '', $path);
- $vars['format'] = $suffix;
+ if ($suffix == 'htm') {
+ $path = str_replace('.'.$suffix, '', $path);
+ $vars['format'] = 'html';
+ } else {
+ $path = str_replace('.'.$suffix, '', $path);
+ $vars['format'] = $suffix;
+ }
}
}
}
## -93,7 +98,8 ##
{
if($format = $uri->getVar('format', 'html'))
{
- $route .= '.'.$format;
+ //$route .= '.'.$format;
+ $route .= '.htm';
$uri->delVar('format');
}
}
Related
I want to install a patch to my project
Patch like this:
Index: vendor/magento/framework/DB/Adapter/Pdo/Mysql.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- vendor/magento/framework/DB/Adapter/Pdo/Mysql.php (revision 6a8701ca9402697f5eaf022e35b9217d3281546c)
+++ vendor/magento/framework/DB/Adapter/Pdo/Mysql.php (date 1553502112000)
## -2904,7 +2904,7 ##
if (isset($condition['to'])) {
$query .= empty($query) ? '' : ' AND ';
$to = $this->_prepareSqlDateCondition($condition, 'to');
- $query = $this->_prepareQuotedSqlCondition($query . $conditionKeyMap['to'], $to, $fieldName);
+ $query = $query . $this->_prepareQuotedSqlCondition($conditionKeyMap['to'], $to, $fieldName);
}
} elseif (array_key_exists($key, $conditionKeyMap)) {
$value = $condition[$key];
I also added to the composer:
"extra": {
"magento-force": "override",
"patches": {
"magento/framework": {
"Fix: PRODSECBUG-2198":
"patches/composer/magento/framework/PRODSECBUG2198.patch"
}
}
}
When I try to run composer install then return this error:
Could not apply patch! Skipping. The error was: Cannot apply patch patches/composer/magento/framework/PRODSECBUG2198.patch
Project for Magento 2.2.7, I installed cweagans/composer-patches but still have problem. Someone can help?
I don't have too much experience with the patches package, but in one of our project, we use it too. In the patch file, the location to the files to be patched is given relative to the package root. So, if you want to patch something in magento/framework, your patch file should probably use DB/Adapter/Pdo/Mysql.php as the filenames
I'm getting users' profile pictures from another site. I want to create a folder for users who have a URL for the image. Because every user's profile picture must be in its own file. This is what I want to do. I'm running with custom artisan commands.
foreach ($adminUser as $user) {
$a= DB::table('users')->where('email', $user['email'])->first();
if($a) {
echo "\n ", $a->name, " this user already exists. \n";
continue;
} else {
$a = User::create($user);
echo "\n ", $user['name'], " created. \n";
if (isset($user['link']) && strlen($user['link']) > 0) {
$folder_Path = public_path().'/user_images/' . $a->id;
File::makeDirectory($folder_Path, $mode = 0777, true, true);
$contents = file_get_contents($user['link']);
$file_name = basename($user['link']);
Storage::disk('uploads')->put($file_name, $contents);
$this->info(" |--> Profile picture uploaded.");
}
}
I have a code which is shown below which contains uri and suppose the uri passed is http://website.com/accounts/school/index/fr_id/1/stateID/14683/school_name/BANGALORE INTERNATIONAL SCHOOL(UOL)/
$uri=$this->uri->uri_to_assoc(4);
if(isset($uri['fr_id'])) { $fr_id=$uri['fr_id']; }
else{ $fr_id=''; }
if(isset($uri['stateID'])) { $stateID=$uri['stateID']; }
else{ $stateID=''; }
if(isset($uri['school_name'])) { $school_name=$uri['school_name']; }
else{ $school_name='';
echo $fr_id.$stateID.$school_name;exit;
}
Using this statement , $uri=$this->uri->uri_to_assoc(4); I cant get the values which is passed in the url and need to be checked with the if statement. Can anyone help me out with this ? When I am echoing the values of $fr_id, $stateID and $school_name, they are empty.
public function function_name()
{
$uri = $this->uri->uri_to_assoc();
echo $pp=$uri['stateID'];
echo $school_name=$uri['school_name'];
echo $fr_id=$uri['fr_id'];
}
It will working fine
Hope this will help you :
do it like this :
$uri = $this->uri->uri_to_assoc(3);
/* OR simply use this */
$uri = $this->uri->uri_to_assoc();
$fr_id = ! empty($uri['fr_id']) ? $uri['fr_id'] : '';
$stateID = ! empty($uri['stateID']) ? $uri['stateID'] : '';
$school_name = ! empty($uri['school_name']) ? $uri['school_name'] : '';
echo $fr_id.' '.$stateID.' '.$school_name;die;
/*Output - 1 14683 BANGALORE*/
For more : https://www.codeigniter.com/userguide3/libraries/uri.html#CI_URI::uri_to_assoc
The json output is not generated by Ext getcontentbyajax in TYPO3 ver. 4.7. It invokes an 500 Internal server error. In the serverlog i found the error is in line 42 of /lib/class.tx_getcontentbyajax.php.
switch(t3lib_div::_GP('todo')){
I found a 4.7 issue on:
http://lists.typo3.org/pipermail/typo3-german/2012-September/087865.html
t3lib_div::GPvar() changes to t3lib_div::_GP()
When you change all GPvar's to _GP the extension works fine.
Here the changed method main() form /lib/class.tx_getcontentbyajax.php of getcontentbyajax extension:
public function main(){
switch(t3lib_div::_GP('todo')){
case 'pagebrowser':
$href = str_replace(t3lib_div::getIndpEnv('TYPO3_SITE_URL'), '', t3lib_div::_GP('href')); // IE6 has problems
$requestedPage = file_get_contents(urldecode(t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $href));
/*preg_match('/<div.*?id\=[\"]{0,1}' . t3lib_div::GPvar('part') . '[\"]{0,1}.*?>[\r\n]{0,2}<!--ajaxreplace-->[\s]{0,}(.*?)[\s]{0,}<!--ajaxreplace-->[\r\n]{0,2}<\/div>/s', $requestedPage, $matches);*/
preg_match('/<!--ajaxreplace-->(.*?)<!--ajaxreplace-->/s', $requestedPage, $matchesContent);
preg_match('/<title>(.*?)<\/title>/s', $requestedPage, $matchesTitle);
if(array_key_exists(1, $matchesContent)){
if(array_key_exists(1, $matchesTitle)){
$this->data['title'] = $matchesTitle[1];
}
$this->data['content'] = $matchesContent[1];
$this->data['success'] = true;
} else {
$this->data['content'] = 'An error occured, please reload the site or click this link to load your desired page.';
$this->data['success'] = false;
}
// hook
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['getcontentbyajax']['mainHook'])){
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['getcontentbyajax']['mainHook'] as $_classRef){
$_procObj = & t3lib_div::getUserObj($_classRef);
$this->data = $_procObj->extraGlobalMarkerProcessor($this, $this->data);
}
}
break;
}
echo json_encode($this->data);
}
i receive an CSV File from the User and I want to insert it into the Database. I want to use the Form Validation:
$pf = new ProductForm();
$old_memory_usage = 0;
while($data = $csvreader->read())
{
$mem = memory_get_usage() / 1024;
echo "Memory-Usage: " . $mem . " KB; Mem-Diff: " . $mem - $old_memory_usage . "\n";
$old_memory_usage = $mem;
$p = new Product();
$p->fromArray($data);
$pf->bind($p->toArray(), array());
if($pf->isValid())
{
$p->save();
}
else
{
//display error message to the user
}
}
This works fine when isValid() returns true. The Memory Difference is 0 KB. But if there is an Error in the "form" the memory-difference is 6-7 KB. So I get an allowed_memory error when the CSV-File is very huge.
I tryed to free the form like:
unset($pf)
$pf = null;
$pf = new ProductForm();
no success. It is just worse!
ans ideas?
thx!
You can disable doctrine profiler in your databse yml:
dev:
doctrine:
class: sfDoctrineDatabase
param:
profiler: false