See http://community.actinic.com/showthread.php?t=48787 post #4, where earlier today I suggested two tweaks (to different code) that make it survive Actinic upgrades and also make it version number independent.
Should be easy to apply the same ideas to the above.
Announcement
Collapse
No announcement yet.
Bypassing cgi-bin links solution 2 - community collaboration.
Collapse
X
-
I can't comment on your code but the 8 does indeed need changing to 10 for the Actinic version.
Leave a comment:
-
Why hasn't this been developed to come out of the box in v10?
This would be great if I could get it to work.
I've tried a few times now but always get the same error, no doubt I'm a duffus and should see something glaringly wrong but in v10 in preview mode (not going live unless someone tells me it sorts it's self by publishing live) the links fro SPP return:
p.s linesWarning: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 354 Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 356 Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result resource in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 357 Warning: odbc_close(): supplied argument is not a valid ODBC-Link resource in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 360 Notice: Undefined variable: parentid in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 361 Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 372 Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 374 Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result resource in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 375 Warning: odbc_close(): supplied argument is not a valid ODBC-Link resource in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 378 Notice: Undefined variable: parentid in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 379 Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 336 Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 338 Warning: odbc_fetch_row(): supplied argument is not a valid ODBC result resource in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 339 Warning: odbc_close(): supplied argument is not a valid ODBC-Link resource in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 343 Notice: Undefined variable: url in C:\Program Files (x86)\Actinic v10\actinic_main.php on line 344Should this be the version number of actinic? in any case I tried with 8 without and with 10 all with the same result.$connect = odbc_connect("ActinicCatalog8","","");
Any thoughts?... or will actinic get around to adding this as standard to new releases.
Regards
Bangers
Leave a comment:
-
Nothing helpful to add, but I've just tried this and it works a treat in V9
Thanks chaps!
Leave a comment:
-
actually need to link to product from brochure fragmentOriginally posted by NormanRouxel View PostIf you mean link to a Brochure page, then all you need is:
Code:<a href="<actinic:variable name="BrochurePageURL" />"><actinic:variable name="BrochureName" /></a>
also lost the preview of the whole site, and online preview not working aslo??
however the cosde is working for the marketing list.
i want to add it to the code for the slide on th efront page of th esite,
http://www.novadetox.co.uk
cheers, lee
Leave a comment:
-
If you mean link to a Brochure page, then all you need is:
Code:<a href="<actinic:variable name="BrochurePageURL" />"><actinic:variable name="BrochureName" /></a>
Leave a comment:
-
Can i use this to link a fragment??Originally posted by gabrielcrowe View Postinclude this code at the end of your actinic_main.php then restart actinic.
PHP Code:/***************************************************************
* GetSectFileName - A support function for Ref2File
***************************************************************/
function GetSectFileName($sectref)
{
$connect = odbc_connect("ActinicCatalog8","","");
$query = "SELECT [sPageName] FROM [Catalog Section] WHERE [nSectionID]=".$sectref."";
$result = odbc_exec($connect, $query);
while(odbc_fetch_row($result)){
//$name = odbc_result($result, 2);
$url = odbc_result($result, 1);
}
odbc_close($connect);
return $url;
}
/***************************************************************
* GetProdParent - A support function for Ref2File
***************************************************************/
function GetProdParent($prodrefs)
{
$prodrefs = str_replace("{","",$prodrefs);
$prodrefs = str_replace("}","",$prodrefs);
$connect = odbc_connect("ActinicCatalog8","","");
$query = "SELECT [nParentSectionID] FROM [product] WHERE [Product Reference]='".$prodrefs."'";
$result = odbc_exec($connect, $query);
while(odbc_fetch_row($result)){
$parentid = odbc_result($result, 1);
}
odbc_close($connect);
return $parentid;
}
/***************************************************************
* GetSectParent- A support function for Ref2File
***************************************************************/
function GetSectParent($sectrefs)
{
$prodrefs = str_replace("{","",$sectrefs);
$prodrefs = str_replace("}","",$sectrefs);
$connect = odbc_connect("ActinicCatalog8","","");
$query = "SELECT [nParentSectionID] FROM [Catalog section] WHERE [nSectionID]=".$sectrefs."";
$result = odbc_exec($connect, $query);
while(odbc_fetch_row($result)){
$parentid = odbc_result($result, 1);
}
odbc_close($connect);
return $parentid;
}
/***************************************************************
* Ref2file - Use Actinic's pwn database, to convert a prod ref, to a filename
* @param int $ref the product reference.
* @author Gabriel Crowe + NormanRouxel 08 September 2007
*
* usage example:
<a href="<actinic:variable name="CatalogURL" /><actinic:block php="true">echo Ref2file("<actinic:variable Name="ProductReference" />");</actinic:block>">Link Text</a>
***************************************************************/
function Ref2File($ref) {
return GetSectFileName(GetProdParent($ref));
}
function Ref2ParentFile($ref) {
return GetSectFileName(GetSectParent(GetProdParent($ref)));
}
then make a link like this, wherever a product reference is in context, such as a marketing item.HTML Code:<a href="<actinic:variable name="CatalogURL" /><actinic:block php="true">echo Ref2file("<actinic:variable Name="ProductReference" />");</actinic:block>">Link Text</a>
To get the parent of the section your item is in (for single product per page lists) then make a link like this:
This will traverse up another level.HTML Code:<a href="<actinic:variable name="CatalogURL" /><actinic:block php="true">echo Ref2ParentFile("<actinic:variable Name="ProductReference" />");</actinic:block>">Link Text</a>
what does the code do? basically, it uses actinics own database to find the name of the section that pertains to a product. by using the product reference. The code may cause some slowdown on larger shops, but really, all it does is convert the prodref, to the filename online.
note:
**EXPERIMENTAL** causes some errors occasionally when actinic closes. Other than that, how about some testing and input?
special thanks go to NormanRouxel for the initial code.
i got a sliding menu on my index that goes through the cgi bin, is it possible to link this directly??
<actinic:block if="%3cactinic%3avariable%20name%3d%22FragmentImageFileName%22%20%2f%3e%20%21%3d%20%22%22" >
<li>
<actinic:block if="%3cactinic%3avariable%20name%3d%22IsFragmentImageALink%22%20%2f%3e" >
<actinic:block if="%3cactinic%3avariable%20name%3d%22IsFragmentLinkToURL%22%20%2f%3e" >
<a href="<actinic:variable name="FragmentLinkedItemID" />">
</actinic:block>
<actinic:block if="%3cactinic%3avariable%20name%3d%22IsFragmentLinkToProduct%22%20%2f%3e" >
<a href="<actinic:variable name="SearchCGIURL" />?PRODREF=<actinic:variable name="FragmentLinkedItemID" /><actinic:block if="%3cactinic%3avariable%20name%3d%22IsHostMode%22%20%2f%3e" >&SHOP=<actinic:variable name="ShopID" /></actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e">&NOLOGIN=1</actinic:block>">
</actinic:block>
<actinic:block if="%3cactinic%3avariable%20name%3d%22IsFragmentLinkToSection%22%20%2f%3e" >
<a href="<Actinic:Variable Name="SearchCGIURL"/>?SECTIONID=<actinic:variable name="FragmentLinkedItemID" /><actinic:block if="%3cactinic%3avariable%20name%3d%22IsHostMode%22%20%2f%3e">&SHOP=<Actinic:Variable Name="ShopID"/></actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e">&NOLOGIN=1</actinic:block>">
</actinic:block>
</actinic:block>
<img src="<actinic:variable name="FragmentImageFileName" />" height="200" width="325" alt="<actinic:variable encoding="strip" name="FragmentTitle" />">
<actinic:block if="%3cactinic%3avariable%20name%3d%22IsFragmentImageALink%22%20%2f%3e" >
</a>
</actinic:block>
<h2><actinic:variable encoding="strip" name="FragmentTitle" /></h2>
<p> <actinic:variable encoding="actinic" name="FragmentText" /></p>
</li>
</actinic:block>
thanks in advance, lee
Leave a comment:
-
Have read through the block tutorials by Gabe on the forum? You can probably do what you want using a ChildSectionList block
Leave a comment:
-
I believe the solution posted in this thread nearly solves my problem but I don't know how to modify it to do so. Can anyone help?
In any given section I want to display the section images of it's siblings.
E.g. In the example below, if I am on section "Sect AB" I would see section images of "Sect AA", "Sect AC" and "Sect AD"
Sect A
Sect AA
Sect AB
Sect AC
Sect AD
Sect B
Sect BA
Sect BB
Sect C
I have tried to find a ParentSectionID variable but this does not seem to exist.The code in this thread would seem to offer the solution. How would I modify it or is there a better way?
Thanks
Leave a comment:
-
After several days of trying to understand how the code works and even buying a book on Perl I think I've found the problem.
The code appears to work fine - it's the database that doesn't hold the information the code is requesting.
If I open up the database in Access and look in the table Catalog Section there are no records in sPageName apart from where I have specified a page name within Actinic.Code:$connect = odbc_connect("ActinicCatalog9","",""); $query = "SELECT [sPageName] FROM [Catalog Section] WHERE [nSectionID]=".$sectref."";
I don't know if this is normal but I let Actinic generate its own pagenames for all my products to help with SEO.
The only table I can find the actual page name is FileList and I can't see any relationship to either the product or the section in there.
Does anyone know how these are linked or how I can get Actinic to populate the sPageName records?
Leave a comment:
-
Some progress made
I've got rid of all the errors and can get Ref2ParentFile to work.
The same can't be said of Ref2File which just appears to be empty - I have placed it outside of the href to confirm the result of this function is blank.
Here is my code to date:-
This is in a layout placed in the head section as beforeCode:<actinic:block php="true" > if (!function_exists('GetSectFileName')) { /*************************************************************** * GetSectFileName - A support function for Ref2File ***************************************************************/ function GetSectFileName($sectref) { $connect = odbc_connect("ActinicCatalog9","",""); $query = "SELECT [sPageName] FROM [Catalog Section] WHERE [nSectionID]=".$sectref.""; $result = odbc_exec($connect, $query); while(odbc_fetch_row($result)){ //$name = odbc_result($result, 2); $url = odbc_result($result, 1); } odbc_close($connect); return $url; } } if (!function_exists('GetProdParent')) { /*************************************************************** * GetProdParent - A support function for Ref2File ***************************************************************/ function GetProdParent($prodrefs) { $prodrefs = str_replace("{","",$prodrefs); $prodrefs = str_replace("}","",$prodrefs); $connect = odbc_connect("ActinicCatalog9","",""); $query = "SELECT [nParentSectionID] FROM [product] WHERE [Product Reference]='".$prodrefs."'"; $result = odbc_exec($connect, $query); while(odbc_fetch_row($result)){ $parentid = odbc_result($result, 1); } odbc_close($connect); return $parentid; } } if (!function_exists('GetSectParent')) { /*************************************************************** * GetSectParent- A support function for Ref2File ***************************************************************/ function GetSectParent($sectrefs) { $prodrefs = str_replace("{","",$sectrefs); $prodrefs = str_replace("}","",$sectrefs); $connect = odbc_connect("ActinicCatalog9","",""); $query = "SELECT [nParentSectionID] FROM [Catalog section] WHERE [nSectionID]=".$sectrefs.""; $result = odbc_exec($connect, $query); while(odbc_fetch_row($result)){ $parentid = odbc_result($result, 1); } odbc_close($connect); return $parentid; } } if (!function_exists('Ref2File')) { function Ref2File($ref) { return GetSectFileName(GetProdParent($ref)); } } if (!function_exists('Ref2ParentFile')) { function Ref2ParentFile($ref) { return GetSectFileName(GetSectParent(GetProdParent($ref))); } } </actinic:block>
This is what I have in the mini related product layout
Any further ideas?Code:<a href="<actinic:variable name="CatalogURL" /><actinic:block php="true">echo Ref2file("<actinic:variable Name="ProductReference" />");</actinic:block>">Link Text</a>
Leave a comment:
-
That's right.it is Actinic_Main.php in the program files folder rather than anywhere else
Leave a comment:
-
I have tried that Norman.
Just to make sure - it is Actinic_Main.php in the program files folder rather than anywhere else?
Leave a comment:
-
You have to close and restart Actinic after making any changes to actinic_main.php.
Leave a comment:
-
Still no joy
I have removed the extra code from Actinic_main.php
I created a new layout called PHPStuff and added the following code
I then inserted the PHPStuff layout into the head section. This caused all sorts of warnings so I wrapped it in a block with PHP=True and Selectable=False which stopped the errors.Code:if (!function_exists('GetSectFileName')) { /*************************************************************** * GetSectFileName - A support function for Ref2File ***************************************************************/ function GetSectFileName($sectref) { $connect = odbc_connect("ActinicCatalog8","",""); $query = "SELECT [sPageName] FROM [Catalog Section] WHERE [nSectionID]=".$sectref.""; $result = odbc_exec($connect, $query); while(odbc_fetch_row($result)){ //$name = odbc_result($result, 2); $url = odbc_result($result, 1); } odbc_close($connect); return $url; } } if (!function_exists('GetProdParent')) { /*************************************************************** * GetProdParent - A support function for Ref2File ***************************************************************/ function GetProdParent($prodrefs) { $prodrefs = str_replace("{","",$prodrefs); $prodrefs = str_replace("}","",$prodrefs); $connect = odbc_connect("ActinicCatalog8","",""); $query = "SELECT [nParentSectionID] FROM [product] WHERE [Product Reference]='".$prodrefs."'"; $result = odbc_exec($connect, $query); while(odbc_fetch_row($result)){ $parentid = odbc_result($result, 1); } odbc_close($connect); return $parentid; } } if (!function_exists('GetSectParent')) { /*************************************************************** * GetSectParent- A support function for Ref2File ***************************************************************/ function GetSectParent($sectrefs) { $prodrefs = str_replace("{","",$sectrefs); $prodrefs = str_replace("}","",$sectrefs); $connect = odbc_connect("ActinicCatalog8","",""); $query = "SELECT [nParentSectionID] FROM [Catalog section] WHERE [nSectionID]=".$sectrefs.""; $result = odbc_exec($connect, $query); while(odbc_fetch_row($result)){ $parentid = odbc_result($result, 1); } odbc_close($connect); return $parentid; } } if (!function_exists('Ref2File')) { /*************************************************************** * Ref2file - Use Actinic's pwn database, to convert a prod ref, to a filename * @param int $ref the product reference. * @author Gabriel Crowe + NormanRouxel 08 September 2007 * * usage example: <a href="<actinic:variable name="CatalogURL" /><actinic:block php="true">echo Ref2file("<actinic:variable Name="ProductReference" />");</actinic:block>">Link Text</a> ***************************************************************/ function Ref2File($ref) { return GetSectFileName(GetProdParent($ref)); } } if (!function_exists('Ref2ParentFile')) { function Ref2ParentFile($ref) { return GetSectFileName(GetSectParent(GetProdParent($ref))); } }
I then used the following in a marketing list
After uploading and clicking on the Link Text I still get the following errorCode:<a href="<actinic:variable name="CatalogURL" /><actinic:block php="true">echo Ref2file("<actinic:variable Name="ProductReference" />");</actinic:block>">Link Text</a>
Any more pointers to help a numpty understand?Code:Forbidden You don't have permission to access /acatalog/Fatal error: Call to undefined function Ref2file() in main on line 1 on this server.
Leave a comment:
Leave a comment: