Post by desperado » Fri Nov 11, 2011 4:46 am

I wrote a standalone php file that I am trying to include somewhere and it doesn't seem to be working.

if I modify the actual file with

Code: Select all

include('addons/test.php');
it works fine.

If I try a VQMod, it fails.

Code: Select all

<modification>
	<id>Test for OpenCart 1.5</id>
	<version>1.1.1</version>
	<vqmver>2.1</vqmver>
	<author>Eric</author>
	<file name="index.php">
		<operation>
		<search position="after"><![CDATA[require_once('config.php');]]></search>
		<add><![CDATA[include('addons/test.php');]]></add>
		</operation>
	</file>
</modification>
Actually, I can't say it fails, because I get no vqmod log error, and no php error. I have tried including it in different files, but I get similar results. could there be issues with caching or otherwise?

Newbie

Posts

Joined
Wed Nov 09, 2011 2:15 am

Post by wernerrenrew » Fri Nov 11, 2011 5:23 am

Hi,

When i first started to use vqmod i took a peek at it's code and i remember that on install it changes the index to it's needs, you can use vqmod for every file loaded after the index.

Regards Werner

User avatar
Active Member

Posts

Joined
Thu Oct 27, 2011 9:48 pm
Location - Netherlands

Post by Qphoria » Fri Nov 11, 2011 5:34 am

Right.. you cannot use vQmod on index.php files as that is the page that loads vQmod... Chicken and Egg

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by wernerrenrew » Fri Nov 11, 2011 6:07 am

Hmmm chicken :D

User avatar
Active Member

Posts

Joined
Thu Oct 27, 2011 9:48 pm
Location - Netherlands

Post by Xsecrets » Fri Nov 11, 2011 6:15 am

It's not really the right place to put it, but when I was looking for somewhere to stick code using vqmod that runs before the controllers do I hijacked the top of the maintenance file because it gets run as a preaction and runs before any controllers get loaded.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by Qphoria » Fri Nov 11, 2011 9:21 am

Xsecrets wrote:It's not really the right place to put it, but when I was looking for somewhere to stick code using vqmod that runs before the controllers do I hijacked the top of the maintenance file because it gets run as a preaction and runs before any controllers get loaded.
Wasn't startup.php good enough? Or was it too early in the script?

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by desperado » Fri Nov 11, 2011 9:28 am

Thanks gentlemen.

I move it to the header.tpl. It doesn't really need to execute at that high a level. I also noticed a typo once I moved it.

now works as advertised.

Newbie

Posts

Joined
Wed Nov 09, 2011 2:15 am

Post by Xsecrets » Fri Nov 11, 2011 9:57 am

Qphoria wrote:
Xsecrets wrote:It's not really the right place to put it, but when I was looking for somewhere to stick code using vqmod that runs before the controllers do I hijacked the top of the maintenance file because it gets run as a preaction and runs before any controllers get loaded.
Wasn't startup.php good enough? Or was it too early in the script?
well I needed the session library to be loaded already, so startup was too early. I would be nice if the preaction section was somewhere that you could modify with vqmod, because it's the perfect place for lots of things.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by 3rdcorner » Sat Oct 13, 2012 1:05 am

Code: Select all

	<file name="system/engine/front.php">
		<operation error="log">
			<search position="after"><![CDATA[public function dispatch($action, $error) {]]></search>
			<add><![CDATA[$this->addPreAction(new Action('common/xen_seo_url'));]]></add>
		</operation>
	</file>
O0

Feels hackish, but so is the concept of vqmods anyways. Ideally we should be able to overload controllers and use OOP without modifying core files, but meh.

Edit: VQMods is great, btw.

My recommendation is to create a /modules/ folder where you store packages for OpenCart so they can be easily transferred between projects using the /modules/ folder and a vqmod sparingly to force inclusion of files rather than multiple lines of code inside the .xml files. This is much more maintainable than trying to get syntax highlighting for PHP working inside an XML file, or copying-and-pasting ad infinitum.

New member

Posts

Joined
Sun Dec 20, 2009 2:35 pm

Post by Qphoria » Sat Oct 13, 2012 4:10 am

3rdcorner wrote:

Code: Select all

	<file name="system/engine/front.php">
		<operation error="log">
			<search position="after"><![CDATA[public function dispatch($action, $error) {]]></search>
			<add><![CDATA[$this->addPreAction(new Action('common/xen_seo_url'));]]></add>
		</operation>
	</file>
O0

Feels hackish, but so is the concept of vqmods anyways. Ideally we should be able to overload controllers and use OOP without modifying core files, but meh.

Edit: VQMods is great, btw.

My recommendation is to create a /modules/ folder where you store packages for OpenCart so they can be easily transferred between projects using the /modules/ folder and a vqmod sparingly to force inclusion of files rather than multiple lines of code inside the .xml files. This is much more maintainable than trying to get syntax highlighting for PHP working inside an XML file, or copying-and-pasting ad infinitum.
You will want to check this out:
http://forum.opencart.com/viewtopic.php?f=24&t=85873

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: No registered users and 3 guests