Post by openmycart.com » Wed Feb 23, 2011 2:42 am

why don't use another way? e.g.

Code: Select all

<operation>
<search position="before" index="1">
  <![CDATA[
   <script type="text/javascript">
  ]]>
</search>
<add trim="true">
   <![CDATA[ <!-- ]]>
</add>
</operation>

<operation>
<search position="after" index="1">
  <![CDATA[
   </script>
  ]]>
</search>
<add trim="true">
   <![CDATA[ --> ]]>
</add>
</operation>
it's not the most good solution but it will work fine
Last edited by openmycart.com on Wed Feb 23, 2011 2:48 am, edited 1 time in total.

Find and get many various of opencart modules, themes, mods, etc for your opencart store at http://www.openmycart.com/oc/, OPENCART SITE customization and Maintenance supports at here


User avatar
Active Member

Posts

Joined
Tue Oct 12, 2010 4:47 am


Post by reynierpm » Wed Feb 23, 2011 2:48 am

This wont works because at bottom of page exists other </script> tags and if I do this

Code: Select all

<operation>
<search position="after" index="1">
  <![CDATA[
   </script>
  ]]>
</search>
<add trim="true">
   <![CDATA[ --> ]]>
</add>
</operation>
it will add --> when found one :)

User avatar
Active Member

Posts

Joined
Tue Jan 12, 2010 9:51 pm

Post by Qphoria » Wed Feb 23, 2011 2:56 am

just replace instead of after in the first script you tried. Your script basically added "nothing" after the code. You need to replace the code with blank

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by reynierpm » Wed Feb 23, 2011 7:36 am

Hi Qphoria, you mean like this:

Code: Select all

<search position="replace" index="1">
  <![CDATA[
   <script type="text/javascript">
  ]]>
            </search>
            <add trim="true" offset="24">
   <![CDATA[ ]]>
            </add>
        </operation>
this doesn't work either. It delete only the line <script type="text/javascript"> but the rest remains. Now offsset="24" means that I will replace from <script type="text/javascript"> and 24 lines below for nothing? Right?

User avatar
Active Member

Posts

Joined
Tue Jan 12, 2010 9:51 pm

Post by reynierpm » Wed Feb 23, 2011 7:39 am

Another question, when I add something a buch of empty lines appears :p this count when I applied a offsset from specified point before? I mean this:

Code: Select all

line 1
line 2
line 3
is not the same as

Code: Select all

line 1


line 2


line 3

User avatar
Active Member

Posts

Joined
Tue Jan 12, 2010 9:51 pm

Post by Xsecrets » Wed Feb 23, 2011 8:20 am

actually as far as php or html is concerned it is the same since they ignore whitespace. I don't think too many people are going to be inspecting your page source and if they do what do you care if there are some extra line breaks.

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 philbydevil » Wed Feb 23, 2011 8:27 am

reynierpm wrote:Hi Qphoria, you mean like this:

Code: Select all

<search position="replace" index="1">
  <![CDATA[
   <script type="text/javascript">
  ]]>
            </search>
            <add trim="true" offset="24">
   <![CDATA[ ]]>
            </add>
        </operation>
?
I think it needs to be:

Code: Select all

<search position="replace" index="1" offset="24>
  <![CDATA[
   <script type="text/javascript">
  ]]>
            </search>
            <add trim="true">
   <![CDATA[ ]]>
            </add>
        </operation>

I heart cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am

Post by Qphoria » Wed Feb 23, 2011 8:36 am

reynierpm wrote:Hi Qphoria, you mean like this:

Code: Select all

<search position="replace" index="1">
  <![CDATA[
   <script type="text/javascript">
  ]]>
            </search>
            <add trim="true" offset="24">
   <![CDATA[ ]]>
            </add>
        </operation>
this doesn't work either. It delete only the line <script type="text/javascript"> but the rest remains. Now offsset="24" means that I will replace from <script type="text/javascript"> and 24 lines below for nothing? Right?
No.. the offset needs to be in the <Search> tag not the add
<search position="replace" index="1" offset="24">
And yea.. i don't care about line breaks because cleaning them up is a waste of time and can throw off the line count for other edits

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by reynierpm » Wed Feb 23, 2011 9:16 am

Nothing I try as you suggested Qphoria and it doesn't works. The code replace the first <script type="text/javascript"> but leave all the content below and write this:
//----------------------------------------- // Confirm Actions (delete, uninstall) //----------------------------------------- $(document).ready(function(){ // Confirm Delete $('#form').submit(function(){ if ($(this).attr('action').indexOf('delete',1) != -1) { if (!confirm ('Está Usted seguro que quiere hacer esto?')) { return false; } } }); // Confirm Uninstall $('a').click(function(){ if ($(this).attr('href') != null && $(this).attr('href').indexOf('uninstall',1) != -1) { if (!confirm ('Está Usted seguro que quiere hacer esto?')) { return false; } } }); });
at page top. This is the code I'm trying now:

Code: Select all

<operation>
            <search position="replace" index="1" offsset="24">
                <![CDATA[<script type="text/javascript">]]>
            </search>
            <add trim="true">
                <![CDATA[ ]]>
            </add>
        </operation>

User avatar
Active Member

Posts

Joined
Tue Jan 12, 2010 9:51 pm

Post by reynierpm » Wed Feb 23, 2011 9:27 am

Another question: in the original file I have this:

Code: Select all

<li><a href="<?php echo $backup; ?>"><?php echo $text_backup; ?></a></li>
but with vQmod this file is modified as follow:

Code: Select all

<operation>
   <search position="before">
       <![CDATA[ <li><a href="<?php echo $backup; ?>"><?php echo $text_backup; ?></a></li> ]]>
   </search>
   <add>
      <![CDATA[ <?php if($backup): ?> ]]>
   </add>
</operation>
<operation>
   <search position="after">
       <![CDATA[ <li><a href="<?php echo $backup; ?>"><?php echo $text_backup; ?></a></li> ]]>
   </search>
   <add>
      <![CDATA[ <?php endif; ?> ]]>
   </add>
</operation>
If I want to add something else after the line:

Code: Select all

<li><a href="<?php echo $backup; ?>"><?php echo $text_backup; ?></a></li>
Wich is the correct code? This:

Code: Select all

<operation>
   <search position="after" offsset="2">
       <![CDATA[ <li><a href="<?php echo $backup; ?>"><?php echo $text_backup; ?></a></li> ]]>
   </search>
   <add>
      <![CDATA[ // Add something else ]]>
   </add>
</operation>
or:

Code: Select all

<operation>
   <search position="after">
       <![CDATA[ <li><a href="<?php echo $backup; ?>"><?php echo $text_backup; ?></a></li> ]]>
   </search>
   <add>
      <![CDATA[ // Add something else ]]>
   </add>
</operation>
Thx in advance

User avatar
Active Member

Posts

Joined
Tue Jan 12, 2010 9:51 pm

Post by Qphoria » Wed Feb 23, 2011 9:34 am

First thing is important to learn spelling ;)

offsset="24" has too many "s"

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by reynierpm » Wed Feb 23, 2011 9:38 am

Yep my bad :( this part works now ;)

User avatar
Active Member

Posts

Joined
Tue Jan 12, 2010 9:51 pm

Post by reynierpm » Thu Feb 24, 2011 7:49 am

Hi I'm doing a lot of changes and soon when it will be tested will be released ;) but for now I'm need some help. Suppose that I have this code:

Code: Select all

.....
<div id="tab_data">
        <table class="form">
          <tr>
            <td><span class="required">*</span> <?php echo $entry_model; ?></td>
            <td><input type="text" name="model" value="<?php echo $model; ?>" />
              <?php if ($error_model) { ?>
              <span class="error"><?php echo $error_model; ?></span>
              <?php } ?></td>
          </tr>
.....
I want to delete the <tr>...</tr> and it content for $entry_model. I was thinking in this way:

Code: Select all

<search position="replace" error="skip|abort" offset="2"><![CDATA[ <div id="tab_data"> ]]></search>
<add trim="true"><![CDATA[ ]]</add>
But this will replace from DIV to TABLE and I keep both just delete all the TR and it contents as I said. Any help? How I can start deleting from specifying position?

User avatar
Active Member

Posts

Joined
Tue Jan 12, 2010 9:51 pm

Post by reynierpm » Fri Feb 25, 2011 11:04 pm

Hi, I'm experimenting this error in my hosting:
Warning: Cannot modify header information - headers already sent by (output started at /home/xxxxxx/public_html/xxxxx/vqmod/vqcache/vqcache_admin_controller_catalog_product.php:1558) in /home/xxxxx/public_html/xxxxx/vqmod/vqcache/vqcache_system_engine_controller.php on line 27
Can any tell me where the problem is?

User avatar
Active Member

Posts

Joined
Tue Jan 12, 2010 9:51 pm

Post by JAY6390 » Fri Feb 25, 2011 11:08 pm

Open the file
/home/xxxxxx/public_html/xxxxx/vqmod/vqcache/vqcache_admin_controller_catalog_product.php
Find line 1558 and paste it here. That will be making an output of some sort (either accidentally or as part of some debug code I'm guessing)

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by reynierpm » Fri Feb 25, 2011 11:13 pm

Ups this line is empty. I've attached the file ;)

Attachments


User avatar
Active Member

Posts

Joined
Tue Jan 12, 2010 9:51 pm

Post by JAY6390 » Fri Feb 25, 2011 11:16 pm

Well that is the problem, you have a MASSIVE whitespace after the ?>
Open
/admin/controller/catalog/product.php
then remove everything after the ?> to get rid of all the whitespace

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Qphoria » Fri Feb 25, 2011 11:31 pm

wow yea.. that is a lot of white space

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by reynierpm » Fri Feb 25, 2011 11:38 pm

Well maybe this is due to this modification I made:

Code: Select all

<file name="admin/controller/catalog/product.php">
 <!-- Delete all -->
        <operation error="skip|abort" >
            <search position="replace" offset="1139">
                <![CDATA[ class ControllerCatalogProduct extends Controller { ]]>
            </search>
            <add trim="true">
                <![CDATA[ ]]>
            </add>
        </operation>
  <!-- Delete all -->
  <!-- Add all -->
  <operation  error="skip|abort">
            <search position="after">
                <![CDATA[ <?php ]]>
            </search>
            <add>
              // add the same code but with a lot of changes
            </add>
            </search>
 </operation>
</file>
Exists a better way to do this?

User avatar
Active Member

Posts

Joined
Tue Jan 12, 2010 9:51 pm

Post by Qphoria » Fri Feb 25, 2011 11:46 pm

why not just add the new code in the first <add> tag
Also, you keep using <operation error="skip|abort" >

the pipe is just the example to show you all the possible options.. you can't use both
You either skip the one operation if there is an error
or you abort the entire process if there is an error..

in most cases you will want to abort, which is the default anyway, so you can remove the error attribute completely. As it is now, it is just ignoring that attribute because it isn't a valid option.

Image


User avatar
Administrator

Posts

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

Users browsing this forum: No registered users and 4 guests