Adding a Selection

News and announcements on the upcoming Linx v1.0 and Linx Lite

Moderator: kre8web

Adding a Selection

Postby stevan » Fri Oct 19, 2007 9:30 pm

When I ask for a link exchange from someone they normally want to see there site on my site first, So I want to make it so I can tell when I run the Recip Checker it would show that I have requested a link back and that is why the Site Recip URL is missing

SO what I want to do is add in the Add New Link Where it has Active and Suspended I added Requested there that was ok BUT where else do I have to add it ?? as it does not show up any place else it should show up

I added it my other script I use on my other sites BUT can not figure out where to add it in this one besides in ADD A Link

THXS Steve
stevan
 
Posts: 22
Joined: Mon Sep 10, 2007 8:37 pm

Re: Adding a Selection

Postby kre8web » Sun Oct 21, 2007 12:30 pm

Ok you would need to make changes to a number of files, first /admin/incs/admin-search.inc.php as well as /admin/links-add.php and /admin/links-edit.php though if i understand correctly you have already changed these last two files?
kre8web
Site Admin
 
Posts: 184
Joined: Fri Jul 11, 2003 11:40 am
Location: UK

Re: Adding a Selection

Postby stevan » Sun Oct 21, 2007 3:45 pm

Also had to modify links search

Still something is wrong When i add a new link and set it to requested it changes to Active by its self

When I added requested I made it true >>

Steve
stevan
 
Posts: 22
Joined: Mon Sep 10, 2007 8:37 pm

Re: Adding a Selection

Postby kre8web » Sun Oct 21, 2007 4:15 pm

Ok, however this is not a simple thing, you will need to make substantial changes to a number of files as well as the database structure! If you're still interested in doing so you would need to change each file (eg links-search, admin-search,links-add etc) that displays the "active" field and add in an option for "requested" with the form field value of "requested", as setting the value to true will simply set the link as being active. You would then need to edit the database structure to allow this "requested" value for the link_active field. Finally, in links-add.php and links-edit.php you would need to allow this value as a possible value for the link_active field when the form is submitted and validated.
kre8web
Site Admin
 
Posts: 184
Joined: Fri Jul 11, 2003 11:40 am
Location: UK

Re: Adding a Selection

Postby stevan » Sun Oct 21, 2007 4:36 pm

I have done all the changes to everything that has a drop down choice That was the easy part as I use dreamweavr just open it tahat and edit the values

Now the database is nothing thing BUT I think I know where and how but want to ask to make sure I am right

Here is what is there now

--
-- Table structure for table `linx_links`
--
`link_active` enum('false','true') NOT NULL default 'false',

so i need to add this

`link_requested` enum('false','true') NOT NULL default 'false',

I am really trying to learn

Steve
stevan
 
Posts: 22
Joined: Mon Sep 10, 2007 8:37 pm

Re: Adding a Selection

Postby kre8web » Mon Oct 22, 2007 1:29 pm

Almost... Presuming we have form fields in links-add.php similair to the following...

Code: Select all
<select name="link_active" class="selector" id="link_active">
        <option value="true" selected="selected">Active</option>
        <option value="requested">Requested</option>
        <option value="false">Suspended</option>
      </select>


You would need to change the database structure to the following, either through phpMyAdmin if already installed or in /admin/install/mysql.inc.php for a fresh installe as follows...

Code: Select all
link_active enum('false','requested','true') NOT NULL default 'false'


Finally, in the likes of links-add.php you will need to allow 'requested' as a valid option, so around line 30 you should see...

Code: Select all
if($_REQUEST['link_active']=='true' || $_REQUEST['link_active']=='false' ) $link_active = $_REQUEST['link_active']; else $link_active = '';


which you would need to change to...

Code: Select all
if($_REQUEST['link_active']=='true' || $_REQUEST['link_active']=='false' || $_REQUEST['link_active']=='requested' ) $link_active = $_REQUEST['link_active']; else $link_active = '';


Now, you will need to update the /admin/incs/build.class.php to allow links marked as requested to display, you'll need to make the following changes to both the Category constructor and the _parseForLinks() method. In the MySQL query where we currently have...

Code: Select all
WHERE link_active = 'true'


you'd need to change this to

Code: Select all
WHERE ( link_active = 'true' OR link_active = 'requested' )


That should help you make a start :)
kre8web
Site Admin
 
Posts: 184
Joined: Fri Jul 11, 2003 11:40 am
Location: UK

Re: Adding a Selection

Postby stevan » Mon Oct 22, 2007 8:48 pm

Ok added all you said to do BUT something is still wrong It will not hold the requested after I add the new link

BUT I think something is wrong here BUT also I am just quessing

I added this like you posted

`link_active enum('false','requested','true') NOT NULL default 'false'

BUT should it have been this

`link_requested enum('false','requested','true') NOT NULL default 'false'

It just looks like it should be that way ???

Or I am not right :?

I am wrong BUT it does not insert it either

Steve
stevan
 
Posts: 22
Joined: Mon Sep 10, 2007 8:37 pm

Re: Adding a Selection

Postby kre8web » Tue Oct 23, 2007 1:49 pm

In order to view any changes, you will also need to make changes to the functions that display the actual link form, for example /admin/incs/admin-search.inc.php where we have...

Code: Select all
<select name="link_active[]">
  <option value="true" <? if($row['link_active']=='true') echo ' selected="selected" '; ?>>Active</option>
  <option value="false"<? if($row['link_active']=='false') echo ' selected="selected" '; ?>>Suspended</option>
</select>


you would need to add an option to show you're requested value, such as...

Code: Select all
<select name="link_active[]">
  <option value="true" <? if($row['link_active']=='true') echo ' selected="selected" '; ?>>Active</option>
  <option value="requested" <? if($row['link_active']=='requested') echo ' selected="selected" '; ?>>Requested</option>
  <option value="false"<? if($row['link_active']=='false') echo ' selected="selected" '; ?>>Suspended</option>
</select>


An altogether seperate approach would be to use the inbuilt custom link fields to setup your own data variable to store notes about a link, such as if you have requested a link or not, or indeed any other information.
kre8web
Site Admin
 
Posts: 184
Joined: Fri Jul 11, 2003 11:40 am
Location: UK

Re: Adding a Selection

Postby stevan » Tue Oct 23, 2007 8:42 pm

I made all these changes I hope this works If not I will wait till next update and hope you make the changes

links-add
<option value="requested">Requested</option>
line 126

links edit full


<option value="true" <? if($linkData['link_active']=='true') echo ' selected="selected" '; ?>>Requested</option>

line 138


incs/admin_search

<option value="requested" <? if($row['link_active']=='requested') echo ' selected="selected" '; ?>>Requested</option>

line 14


links_add

if($_REQUEST['link_active']=='true' || $_REQUEST['link_active']=='false' || $_REQUEST['link_active']=='requested' ) $link_active = $_REQUEST['link_active']; else $link_active = '';

line 30



/admin/incs/build.class.php


WHERE ( link_active = 'true' OR link_active = 'requested' )


line 65


Changed this

`link_active` enum('false','true') NOT NULL default 'false',

to this

`link_active enum('false','requested','true') NOT NULL default 'false'
stevan
 
Posts: 22
Joined: Mon Sep 10, 2007 8:37 pm

Re: Adding a Selection

Postby kre8web » Wed Oct 24, 2007 12:54 pm

Few small errors in there...

links edit full should be
Code: Select all
<option value="requested" <? if($linkData['link_active']=='requested') echo ' selected="selected" '; ?>>Requested</option>

line 138

in links_add, where you have made the changes below, you will also need todo similair in links-edit.php approx line 76 and also links-edit-full.php around line 34

Code: Select all
if($_REQUEST['link_active']=='true' || $_REQUEST['link_active']=='false' || $_REQUEST['link_active']=='requested' ) $link_active = $_REQUEST['link_active']; else $link_active = '';


Note links-edit.php uses a slightly different format as per below...

Code: Select all
if($_REQUEST['link_active'][$i]=='true') $link_active = $_REQUEST['link_active'][$i]; else $link_active = 'false';


it should be changed to...

Code: Select all
if($_REQUEST['link_active'][$i]=='true' || $_REQUEST['link_active'][$i]=='false' || $_REQUEST['link_active'][$i]=='requested' ) $link_active = $_REQUEST['link_active'][$i]; else $link_active = '';


Also im concerned where you made the change...

Code: Select all
link_active enum('false','requested','true') NOT NULL default 'false'


this change needs to be made to the actual live database if you have already installed linx-lite, you cannot change this value by editing any scripts unless you are going todo a fresh installation. In which case, it should be changed in /install/mysql.inc.php

Again though i'd suggest you look into using the custom fields as they will allow you to store any type of data you wish on a link without the need to edit the scripts in any place :)
kre8web
Site Admin
 
Posts: 184
Joined: Fri Jul 11, 2003 11:40 am
Location: UK

Re: Adding a Selection

Postby stevan » Wed Oct 24, 2007 7:03 pm

Still changes back to Active when I look at it and does not show


ALso I did add this link_active enum('false','requested','true') NOT NULL default 'false'

TO the /install/mysql.inc.php and deleted the database and reinstalled it
stevan
 
Posts: 22
Joined: Mon Sep 10, 2007 8:37 pm

Re: Adding a Selection

Postby kre8web » Thu Oct 25, 2007 11:52 am

Hmm, im not really sure what else to suggest then, other than you look into using the custom fields to store your data :(
kre8web
Site Admin
 
Posts: 184
Joined: Fri Jul 11, 2003 11:40 am
Location: UK


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron