{Hướng dẫn} 1 số lỗi thường gặp - cách fix lỗi

Thảo luận trong 'Mới sử dụng Joomla' bắt đầu bởi joomla, 28/2/12.

  1. joomla

    joomla OMG Staff Member

    Bài viết:
    1,068
    Likes :
    2,262
    Ở đây template mình dùng là gk_your shop, những template khác tương tự.
    1. Nếu bạn muốn chỉnh cỡ chữ mặc định của tiêu đề các bài viết trong joomla thì bạn chỉnh file CSS trong template đang dùng 1. Chỉnh cỡ chữ của tiêu đề bài viết (bài viết ở đây là các article của joomla) trong file template-của-bạn/css/joomla.css đoạn code giống như .contentheading Hoặc không có thì thêm đoạn code này vào file đó

    2. Chỉnh cỡ chữ của tiêu đề sản phẩm (đây là tiêu đề các sản phẩm - item của k2 community) tại dòng 108 trong file gk_shop/css/k2.css

    3. Trường hợp Xmap bị lỗi (khi bạn cài Xmap có thể và thường thì sẽ xảy ra lỗi này) loading preference: thì vào plugin manager disabled plugin System - Mootools Upgrade

    4. Lỗi khi cài joomfish:
    Khi bạn cài joomfish thường sẽ xảy ra lỗi này: Deprecated: Function ereg_replace() is deprecated in C:\XAMPP\xampp\htdocs\sitesname\plugins\system\jfd atabase\jfdatabase_inherit.php on line 537

    --> Tìm dòng 537 (nếu báo lỗi dòng 537) trong file plugins\system\jfdatabase\jfdatabase_inherit.php thay
    $tableName = ereg_replace( '^#__', '', $table); thành $tableName = preg_replace( "/^#__/", "", $table);

    5. Để mở cửa sổ mới khi kích chuột vào GK3 image slide show khi click vào slide (Tức là khi bạn dùng một module nào đó để hiển thị ảnh, ví dụ như image slide show như của jlv thì làm tương tự như sau)
    --> Chỉnh trong file templates\gk_yourshop\html\mod_gk_image_show\content.php thêm targer=_blank vào thuộc tính href

    6. Lỗi hiển thị SP trong K2 hoặc hiển thị cả category sau khi cài joomla fish (lỗi này thường có khi bạn cài joomfish):
    - Vào administrator/components/com_joomfish/views/translate/tmpl/edit.php bỏ readonly="yes"
    - Khi translate các module hay menu thì xóa link trong textBox của joomfish translate rồi nhấn save

    7. Muốn thêm position (thêm position vào template joomla): Thêm một vị trí module mới vào template, Tạo vị trí mới trong template joomla...
    Vào file templatedetail.xmp thêm tên position sau đó vào file php tương ứng tạo thêm vị trí để load module ở position đó.
    Ví dụ thêm vị trí đển chèn tùy chọn nhiều ngôn ngữ như trên JLV:
    - Vào file templates\gk_yourshop\templatedetail.xml thêm vị trí để chèn module language selection ta thêm đoạn code <position>lang</position>
    - Sau đó thêm vào file templates\gk_yourshop\layouts\blocks\top.php đoạn:
    <?php if($this->countModules('lang')) : ?>
    <jdoc:include type="modules" name="lang" style="none" />
    <?php endif; ?>
    => Hiển thị module language ở position lang. Chú ý là dùng tem nào thì vào xml tem đó để chỉnh nhé, ở đây mình dùng gk_yourshop.

    8. Thêm k2iteam alias trong joomfish (Tức là khi bạn dùng joomfish để bạn dịch một item nào trong k2 thì sẽ có một box là dịch title, một box là dịch alias của title đó. Nhưng thiếu mất box k2item alias):
    - Vào file k2item.xml trong joomfish (Joomfish có một thư mục chứa các file xml của các module khác để hỗ trợ dịch sang ngôn ngữ khác cho cả các module) thêm đoạn code
    <field type="text" name="alias" length="50" maxlength="255" translate="1" posthandler="filterTitle">Alias</field>

    9. Cách thêm tham số Cache cho module Joomla

    Chỉnh sửa file XML của module
    Bạn thêm vào đoạn mã sau (trong cặp <install>):
    <params group="advanced">
    <param name="cache" type="list" default="1" label="Caching"
    description="Select whether to cache the content of this module">
    <option value="1">Use global</option>
    <option value="0">No caching</option>
    </param>
    <param name="cache_time" type="text" default="900"
    label="Cache Time" description="The time before the module is recached" />
    </params>


    10. Tạo banner_adv trên top (tức là thêm một vị trí như kiểu là logo trên banner để phục vụ việc quản cáo)
    - Vào file templates\gk_yourshop\layouts\blocks\top.php thêm đoạn code:

    <?php if ($this->getParam('logoType')=='image'): ?>
    <h1 class="tao_logo"> <a href="http://đường dẫn đến 1 trang html nào đó" title="<?php echo $this->sitename(); ?>" rel="nofollow" target="_blank"><span><?php echo $this->sitename(); ?></span></a> </h1>
    <?php elseif($this->getParam('logoType')=='text') : ?>
    <div class="logo text">
    <h1><a href="index.php" title="<?php echo $this->sitename(); ?>"><span><?php echo GK_LOGO; ?></span></a></h1>
    <p class="site-slogan"><?php echo GK_SLOGAN;?></p>
    </div>
    <?php endif; ?>

    - Tạo một class tao_logo trong file templates\gk_yourshop\css \template.css với nội dung
    h1.tao_logo { float:right; height:103px; padding:0; width:250px; }
    h1.tao_logo a { background:transparent url('../images/style1/ảnh_logo.png') no-repeat 0 0; display:block; height:103px; margin:0; text-indent:-999em; width:250px; }
    div.tao_logo { height:69px; width:auto; float:right; }
    div.tao_logo h1 { font-size:27px; line-height:32px; font-family:Arial, sans-serif; font-weight:bold; margin:10px 10px 4px 10px; }
    div.tao_logo h1 a { color:#46660b!important; font-size:27px!important; text-decoration:none!important; }
    div.tao_logo p { font-size:10px; font-family:Verdana, sans-serif; line-height:12px; color:#000; margin-right:10px; }

    11.Lỗi Warning: get_class() expects parameter 1 to be object, null given in C:\xampp\htdocs\ja_mesolite\templates\ja_mesolite\ ja_menus\Base.class.php on line50
    Cách fix: Tìm trong file base.class.php rồi bỏ đoạn code

    Mã:
    $menu = @JMenu :: getInstance();[/SIZE][/SIZE]
    [SIZE=4][SIZE=4]if(strtolower(get_class($menu)) == 'jexception') {[/SIZE][/SIZE]
    [SIZE=4][SIZE=4]$menu = @JMenu :: getInstance('site');[/SIZE][/SIZE]
    [SIZE=4][SIZE=4]}  


    12.Phần phân trang của các menu sẽ xuất hiện lỗi: Một dòng code nguyên sơ hiện ra cuối trang với nội dung: JPAGE_CURRENT_OF_TOTAL.

    Lỗi này xảy ra do phiên bản mới của Joomla cập nhật thêm trường JPAGE_CURRENT_OF_TOTAL trong phần phân trang (pageination) trong khi các file ngôn ngữ chưa có trường này.

    Vào public_html/language/vi-VN/vi-VN.ini - tìm dòng 258, thêm 1 dòng trắng, dán thêm dòng này vào:

    JPAGE_CURRENT_OF_TOTAL=Trang %s trong tổng số %s trang.

    13.Lỗi : Deprecated: Assigning the return value of new by reference is deprecated in

    Cách sửa: Tìm đến dòng nó báo warning trong file php nó báo lỗi

    Ttìm dòng đại loại như:

    $tên_biến = & new abc;

    Bỏ kí tự "&" đi là hết.

    14.Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a reference, value given in C:\Users\tim\Desktop\timothy\xampp\htdocs\domains\ joomla\libraries\joomla\cache\handler\callback.php on line 99

    Lỗi này bạn vào module bị lỗi và thay đổi thuộc tính type của nó thành Legacy Vertical:
    1. Vào Extensions->Module Manager trong danh sách module bạn chọn module bị lỗi
    2. Tại phần Paramenters của module trong thuộc tính type bạn chọn là Legacy Vertical.

    15.Khi gặp phải lỗi "Error: Any articles to show" bạn cần thử một vài cách sau.
    Lỗi này thường đi kèm với lỗi "DB function failed with error number 1030" trong administrator và kèm theo lỗi "PHP Warning: Invalid argument supplied for foreach()" ở một số module.

    Trước hết bạn vào PHPMyadminREPAIR TABLE, sau đó xóa hết cache của website.
    Nếu vẫn không được bạn cần liên hệ ngay tới nhà cung cấp gói hosting đó cho bạn. Có thể nhiều phần là lỗi từ trên server và lỗi này thường do đĩa cứng của server bị đầy. Bạn đừng vội vàng tác động đến data files và database gì vội nếu trước đó bạn không hề có thay đổi bất thường tới dữ liệu trên host của mình.

    16.Khắc phục lỗi "Strict Standards: Static function JDatabase::test() should not be abstract in.." trêm XAMPP
    ví dụ:

    Strict Standards: Accessing static property JCache::$_handler as non static in C:\xampp1\htdocs\Joomla_17\libraries\joomla\cache\ cache.php on line 394

    Strict Standards: Static function JDatabase::test() should not be abstract in C:\xampp1\htdocs\Joomla_17\libraries\joomla\databa se\database.php on line 350

    Bạn vào file php.ini trong mục C:\XAMPP\php

    - Tìm đến chỗ có chữ "display_errors" và thiết lập giá trị on của nó thành off.

    - Tìm đến error_reporting = E_ALL | E_STRICT thay bằng error_reporting = E_ALL & ~E_NOTICE

    + Nếu vẫn chưa được thì trong file configuration.php của XAMPP bạn thay chỗ $error_reporting = '-1'; thành $error_reporting = '6135';

    + Nếu vẫn chưa được thì Thêm vào trước dòng 516 "error_reporting = E_ALL | E_STRICT"
    Làm lần lượt từng bước một, au đó khởi động lại apache và MySQL nha.

    17.Lỗi "Parse error: syntax error, unexpected $end, expecting T_FUNCTION in"
    Lỗi này thường do bị sai thiếu code, đến dòng báo lỗi trong file đó và thêm dấu } vào là ok!
    18. Sau khi chuyển host vào virtuemart bị lỗi đường dẫn?
    Fix: Đầu tiên bạn vào administrator\components\com_virtuemart
    Tìm file virtuemart.cfg
    Tìm đến đoạn code :
    define( 'URL', 'http://localhost/Shopbluexanh/Sourc/' );
    define( 'SECUREURL', 'http://localhost/Shopbluexanh/Sourc/' );

    Thay thành 2 dòng sau :
    define( 'URL', $mosConfig_live_site.$app );
    define( 'SECUREURL', $mosConfig_live_site.$app);
    Giờ bạn chuyển host thoải mái mà ko sợ lỗi url nữa

    19. Lỗi Invalid argument supplied for foreach() in
    Lỗi vd:
    Fix: Tìm tới dòng 68 trong file : select.php
    Sửa : foreach ($arr as $i => $option)
    Thành: foreach ( (array)$arr as $i => $option)

    20: Lỗi cài đặt bước 6

    (Bài viết được tổng hợp từ nhiều nguồn khác nhau)
     
  2. dinhchi

    dinhchi Administrator Staff Member

    Bài viết:
    1,358
    Likes :
    1,022
    Bổ sung các fix lỗi sau hoặc 1 số lỗi tương tự\
    Cách fix
    mở file C:/windows/php.ini tìm đoạn
    Mã:
    max_execution_time = 30 ; Maximum execution time of each script, in seconds
    max_input_time = 60; Maximum amount of time each script may spend parsing request data
    sửa lại thành tham số lớn hơn tùy ý

    Cuối cùng NHớ restart apache nhé

     
  3. teddy2012

    teddy2012 Mới tham gia

    Bài viết:
    8
    Likes :
    1
    Trong C:/WINDOWS/ của mình tìm mãi ko thấy php.ini đâu cả bạn mình phải làm sao
     
  4. dinhchi

    dinhchi Administrator Staff Member

    Bài viết:
    1,358
    Likes :
    1,022
    bó tay, bạn dùng server gì, bạn sử dụng công cụ tìm kiếm của window mà tìm, giới hạn trong ổ C thôi
     
  5. teddy2012

    teddy2012 Mới tham gia

    Bài viết:
    8
    Likes :
    1
    Đã làm theo nhưng vẫn ko đc hix*Rage*
     
  6. dinhchi

    dinhchi Administrator Staff Member

    Bài viết:
    1,358
    Likes :
    1,022
    ko đc gì, đã chỉnh lại chưa, đã refresh apache chưa
    Chỉnh ở dòng memory_limit = 48M ; Maximum amount of memory a script may consume (8MB)
     
  7. trantrongnguyen

    trantrongnguyen Mới tham gia

    Bài viết:
    1
    Likes :
    0
    e viết bài nhưng khi vào viewsite lại không có bài . giúp e với
     
  8. mrboomba89

    mrboomba89 Moderator

    Bài viết:
    88
    Likes :
    103
    Bạn miêu tả cụ thể hơn được không
     
  9. Huỳnh Thái Đăng Khoa

    Huỳnh Thái Đăng Khoa Mới tham gia

    Bài viết:
    10
    Likes :
    0
    Bạn ơi, bạn giúp mình fix lỗi này được không?
    Warning: include(E:\TAI LIEU HOC THIET KE WEB\Xampp\xampp\htdocs\shopgiay/modules/mod_virtuemart/vm_JSCook.php) [function.include]: failed to open stream: No such file or directory in E:\TAI LIEU HOC THIET KE WEB\Xampp\xampp\htdocs\shopgiay\modules\mod_product_categories\mod_product_categories.php on line 62

    Warning: include() [function.include]: Failed opening 'E:\TAI LIEU HOC THIET KE WEB\Xampp\xampp\htdocs\shopgiay/modules/mod_virtuemart/vm_JSCook.php' for inclusion (include_path='.;E:\TAI LIEU HOC THIET KE WEB\Xampp\xampp\php\PEAR') in E:\TAI LIEU HOC THIET KE WEB\Xampp\xampp\htdocs\shopgiay\modules\mod_product_categories\mod_product_categories.php on line 62

    Mình cài mod_product_categories trong gói comptele Virtuemart 1.1.9 thì khi enable nó thể hiện như vậy đó, mình không biết khắc phục như thế nào nữa, mong bạn chỉ giúp mình
     
  10. joomla

    joomla OMG Staff Member

    Bài viết:
    1,068
    Likes :
    2,262
    Khắc phục theo lỗi 16
     
  11. Huỳnh Thái Đăng Khoa

    Huỳnh Thái Đăng Khoa Mới tham gia

    Bài viết:
    10
    Likes :
    0
    Bạn ơi, mình đã làm theo cách 16 của bạn nhưng mọi thứ vẫn không thay đổi, bạn xem giúp mình mình làm có bị sai gì không nha. fix 1. fix 2. fix 3. fix 4.
     
  12. joomla

    joomla OMG Staff Member

    Bài viết:
    1,068
    Likes :
    2,262
    Khởi động lại Apache, đăng nhập vào administrator của web, rồi chuyển sang tab Server, chỗ báo lỗi chuyển thành node
     
  13. Huỳnh Thái Đăng Khoa

    Huỳnh Thái Đăng Khoa Mới tham gia

    Bài viết:
    10
    Likes :
    0
    bạn ơi, mình không đăng nhập vào admin được, nó hiện lên như thế này loi.
     
  14. buivanbac

    buivanbac Mới tham gia

    Bài viết:
    1
    Likes :
    0
    .htaccess của mình như này lỗi ở điểm nào mong sư huynh chỉ jup . ##
    # @version$Id: htaccess.txt 21101 2011-04-07 15:47:33Z dextercowley $
    # @packageJoomla
    # @copyrightCopyright (C) 2005 - 2011 Open Source Matters. All rights reserved.
    # @licenseGNU General Public License version 2 or later; see LICENSE.txt
    ##

    ##
    # READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
    #
    # The line just below this section: 'Options +FollowSymLinks' may cause problems
    # with some server configurations. It is required for use of mod_rewrite, but may already
    # be set by your server administrator in a way that dissallows changing it in
    # your .htaccess file. If using it causes your server to error out, comment it out (add # to
    # beginning of line), reload your site in your browser and test your sef url's. If they work,
    # it has been set by your server administrator and you do not need it set here.
    ##

    ## Can be commented out if causes errors, see notes above.
    Options +FollowSymLinks

    ## Mod_rewrite in use.

    RewriteEngine On

    ## Begin - Rewrite rules to block out some common exploits.
    # If you experience problems on your site block out the operations listed below
    # This attempts to block the most common type of exploit `attempts` to Joomla!
    #
    # Block out any script trying to base64_encode data within the URL.
    RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
    # Block out any script that includes a <script> tag in URL.
    RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
    # Block out any script trying to set a PHP GLOBALS variable via URL.
    RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
    # Block out any script trying to modify a _REQUEST variable via URL.
    RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
    # Return 403 Forbidden header and show the content of the root homepage
    RewriteRule .* index.php [F]
    #
    ## End - Rewrite rules to block out some common exploits.

    ## Begin - Custom redirects
    #
    # If you need to redirect some pages, or set a canonical non-www to
    # www redirect (or vice versa), place that code here. Ensure those
    # redirects use the correct RewriteRule syntax and the [R=301,L] flags.
    #
    ## End - Custom redirects

    ##
    # Uncomment following line if your webserver's URL
    # is not directly related to physical file paths.
    # Update Your Joomla! Directory (just / for root).
    ##

    # RewriteBase /

    ## Begin - Joomla! core SEF Section.
    #
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    #
    # If the requested path and file is not /index.php and the request
    # has not already been internally rewritten to the index.php script
    RewriteCond %{REQUEST_URI} !^/index\.php
    # and the request is for something within the component folder,
    # or for the site root, or for an extensionless URL, or the
    # requested URL ends with one of the listed extensions
    RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
    # and the requested path and file doesn't directly match a physical file
    RewriteCond %{REQUEST_FILENAME} !-f
    # and the requested path and file doesn't directly match a physical folder
    RewriteCond %{REQUEST_FILENAME} !-d
    # internally rewrite the request to the index.php script
    RewriteRule .* index.php [L]
    #
    ## End - Joomla! core SEF Section.
     
  15. minhductn94

    minhductn94 Mới tham gia

    Bài viết:
    6
    Likes :
    0
    Notice: Array to string conversion in D:\www\joomla15\components\com_content\models\articles.php on line 124 loi nay sua
    tn???
     
  16. SVDM

    SVDM Mới tham gia

    Bài viết:
    1
    Likes :
    0
    Fatal error: Declaration of JInstallation::_createSession() must be compatible with that of JApplication::_createSession() in C:\AppServ\www\Joomla\installation\includes\application.php on line 360

    Mình mới cai Jooomla vào website để cấu hình thì hiện ra lỗi này và mình đã tìm line 360 thì chỉ thấy có dấu "}" này thôi, không biết fix ở đâu.. giúp mình nhé.
     
  17. rocks_fan8x

    rocks_fan8x Mới tham gia

    Bài viết:
    1
    Likes :
    0
    Mình bị lỗi không add image và article được. Ai có thể fix giùm mình được không? mình chọn trình soạn thảo JDE rồi mà vẫn không add được
     
  18. kingstone

    kingstone Rất nhiệt tình

    Bài viết:
    478
    Likes :
    152
    Nó có thông báo lỗi gì ko bạn ?
     
  19. Rion

    Rion Mới tham gia

    Bài viết:
    6
    Likes :
    0
    Warning: number _ format() expects parameter 2 to be long, string given in C:\wamp\www\administrator\components\com_virtuemart\classes\currency\class_currency_display.php on line 107



    giúp mình với !!! chịu thua với cái lỗi này !!! làm ơn giải quyết trong 4 giờ tới !!! mình cần gắp lắm
     
  20. Rion

    Rion Mới tham gia

    Bài viết:
    6
    Likes :
    0
    ah quên nữa , mình ko thể tìm ra line 107 ở trên ,nên chỉ khoảng chừng mà sữa nhưng ko đc !!! Mình mới học Joomla nên cầu mong bạn giúp mình gấp !!! hichic mình sắp nộp bài cho thầy rồi :6.jpg::6.jpg::6.jpg::6.jpg::6.jpg::6.jpg::6.jpg::6.jpg::6.jpg::6.jpg::6.jpg::6.jpg::6.jpg::6.jpg::6.jpg:
     
comments powered by Disqus

Chia sẻ trang này