vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   [cinq's vbArticles v1.0 Hack] - The development process (https://vborg.vbsupport.ru/showthread.php?t=69906)

cinq 01-08-2005 03:39 AM

p.s. At this point in time, I am about 90% done, left with a comment validation system, article search feature for frontend, install script, and perhaps some small icon creation.

It would help speed things up if i could have some person(s) volunteer to do the nifty graphics, and install script, as well as volunteer to be beta testers as it will be released soon for beta testing. :)

------------------------------------
edit: article search done. :D

Guy G 01-08-2005 07:47 AM

would be extremely great if there will be an importer from the v3 article hack...

cinq 01-08-2005 07:54 AM

Well Zorobz, I have not used that hack myself and so don't know what it has done to store the articles and such.

Could be done as an add-on though, to give some the option of switching if they so desire. If someone wishes to volunteer to write an importer of sorts, drop me a PM too and I will provide the tables structure for my hack ;)

p.s. almost done with the comment validation system now too.
Eyes are tired ... must .... must carry on .... :D

j_86 01-08-2005 12:36 PM

Cinq; is it possible to attatch standard files to articles? If so, where do they appear?

cinq 01-08-2005 01:50 PM

Nope, not by default.

j_86 01-08-2005 02:05 PM

Ah ok - can I make it a suggestion, then?

I can imagine a *lot* of tutorial based things will be wanting to attatch files other than images.

cinq 01-08-2005 03:02 PM

pheww...comment validation done.
Time to get some rest before embarking on installation script ....

more updates tomorrow...i hope...;)

cinq 01-08-2005 03:02 PM

Quote:

Originally Posted by JimpsEd
Ah ok - can I make it a suggestion, then?

I can imagine a *lot* of tutorial based things will be wanting to attatch files other than images.

Yes, it will be included as a future feature.

cinq 01-09-2005 05:45 AM

Tried integrating SPAW again, and again to no avail.
Seems to work when I upload it to my server ( just spaw demo ), but I cannot get it to work in my hack on localhost... bummer.

Does any one here use SPAW ?

Should I just not include any WYSIWYG editor ?
ie. no article images upload facility ... ( which most article require though I suspect )

SoloX 01-09-2005 05:49 AM

noo!! keep working cinq ... i no u can do it... spaw or some other editor with upload capability .. is a must ...

but spaw is the coolest!

where does it break? I may be able to help u

cinq 01-09-2005 06:04 AM

For my own use, I already purchased another WSYIWYG editor which integrates real easy and allows for image uploads and even sorting by folders etc.

I have an idea of how it can be done with Spaw as well ( making use of its dynamic img lib feature ).

Currently, when you add an article, the article 'pre-add' handler lets you input the article title first. It then checks the db for the last id entry and increases this count by one to create a folder in your set article img directory. This folder is the placeholder for this particular article's image(s).

This path ( the folder ) can be passed into the dynamic img lib array of Spaw, so that it looks into this folder for either img uploads or inserting of images into the article content.

All this sounds well and good, but at this point in time, I CANT EVEN GET THE EDITOR TO SHOW properly and it is really fustrating.

It gives me all sorts of warnings about not being able to include the neccessary config/control files in the spaw package.

And if I change a lot of the variables in the spaw config files, and do get rid of the warning erros ( hardcoded paths just to test mind you ...for e.g. C:/program files/wamp/www/spaw/config.blah blah ), the warning messages go away, the textarea box shows, but with no WYSIWYG editor interface, just the empty white textarea.....

arghh.

any ideas Solox ?

SoloX 01-09-2005 06:12 AM

I was having similar path issues .. i manually entered these two variables to fix the path problems (in spaw_control.config.php) ..

$_SERVER['DOCUMENT_ROOT'] = '/home/html';
$HTTP_SERVER_VARS["DOCUMENT_ROOT"] = '/home/html';

spaw will not load properly if it cannot determine some of the paths .. try this and see if it helps ..

cinq 01-09-2005 06:24 AM

Ok, I placed the spaw directory into the admincp dir.

I amended the spaw_control.config.php accordingly and this is what it is at the moment ( just the first few lines .. ):

PHP Code:

// directory where spaw files are located
$spaw_dir '/spaw/';

// base url for images
$spaw_base_url 'http://localhost/image/articles';

if (!
ereg('/$''c:/program files/wamp/www/forum/admincp'))
  
$spaw_root 'c:/program files/wamp/www/forum/admincp'.$spaw_dir;
else
  
$spaw_root 'c:/program files/wamp/www/forum/admincp'.substr($spaw_dir,1,strlen($spaw_dir)-1); 

In my file, I added an include which looks like this :

PHP Code:

include_once ('c:/program files/wamp/www/forum/admincp/spaw/spaw_control.class.php'); 

and call the instance using :

PHP Code:

$sw = new SPAW_Wysiwyg('spaw1',stripslashes($HTTP_POST_VARS['spaw1']));
$sw->show(); 

Erros are gone now, but textarea no WYSIWYG controls.

Any ideas ?

p.s. thanks for the paths thingy :)

SoloX 01-09-2005 06:42 AM

I notice u say spaw dir is /spaw/
its not under the root dir if i am reading your config files properly.
Put your entire spaw dir in root and change the include line.
OR
change the spaw dir accoring to the proper relative url

SoloX 01-09-2005 06:51 AM

I am still not convinced spaw is finding all material it needs ..

can u put spaw in root dir and try this block in the config?
PHP Code:

// directory where spaw files are located 
$spaw_dir '/spaw/'

// base url for images 
$spaw_base_url 'http://localhost/'

if (!
ereg('/$'$HTTP_SERVER_VARS['DOCUMENT_ROOT'])) 
$spaw_root $HTTP_SERVER_VARS['DOCUMENT_ROOT'].$spaw_dir
else 
$spaw_root $HTTP_SERVER_VARS['DOCUMENT_ROOT'].substr($spaw_dir,1,strlen($spaw_dir)-1); 


cinq 01-09-2005 06:53 AM

yep, it is in my admincp dir :

ie. forum/admincp/spaw/

I will try your suggestion now.

cinq 01-09-2005 07:06 AM

Quote:

Originally Posted by SoloX
I notice u say spaw dir is /spaw/
its not under the root dir if i am reading your config files properly.
Put your entire spaw dir in root and change the include line.
OR
change the spaw dir accoring to the proper relative url



But I cannot change
$spaw_dir = '/spaw/';
to $spaw_dir = 'c:/program files/wamp/www/forum/admincp/spaw/';

based on the code here :
https://vborg.vbsupport.ru/showpost....9&postcount=53

Since :

$spaw_root = 'c:/program files/wamp/www/forum/admincp'.$spaw_dir;

Changing it would make $spaw_root

'c:/program files/wamp/www/forum/admincp'.'c:/program files/wamp/www/forum/admincp/spaw/'

SoloX 01-09-2005 07:10 AM

ohh .. leme PM u

cinq 01-09-2005 09:00 AM

Close to 2 hrs of debugging SPAW with SoloX later, it still doesn't work .... darn it :(
Thanks for the help though SoloX, appreciate it greatly ! :D

cinq 01-09-2005 12:44 PM

I give up with SPAW.

FCK next

cinq 01-10-2005 01:07 PM

Just an update, optimized several queries with some help here

Working on a report comment, edit comment, delete comment feature now.
Once done, will download FCK and give it a go.

I think I will then wrap things up with an installation script ( 40+ templates, many settings and phrases to create, plus 4 db tables creation ) , if FCK goes smoothly .... unlike spaw ...

Torqued 01-10-2005 01:25 PM

woo hoo! can't wait to see this hack! :)

sabret00the 01-10-2005 03:43 PM

Quote:

Originally Posted by cinq
Problem 2 solved ! ( thanks Rake ! )

Code used :
PHP Code:

 # previous and next article links
    
if($nextone $DB_site->query_first("SELECT articles_articleid FROM " TABLE_PREFIX "articles_article WHERE articles_articleid > $artid AND categoryid = $categoryid ORDER BY articles_articleid ASC LIMIT 1"))
    {
        
$nextone $nextone['articles_articleid'];
        
$nextarticle 1;
    }

    if(
$previousone $DB_site->query_first("SELECT articles_articleid FROM " TABLE_PREFIX "articles_article WHERE articles_articleid < $artid AND categoryid = $categoryid ORDER BY articles_articleid DESC LIMIT 1"))
    {
        
$previousone $previousone['articles_articleid'];
        
$prearticle 1;
    } 

Decided to put in
PHP Code:

AND categoryid $categoryid 

to limit to previous or next articles in the same category.

you can do that in one query.

sabret00the 01-10-2005 03:48 PM

Quote:

Originally Posted by nexialys
1- pagination is a 3 lines code... already have something inside vB for that.

wow, it is, i haven't ever rewritten the code i was giving along time ago for sorting pagenav but the code i have is 30 lines long :shock:

please share the knowledge :o

cinq 01-11-2005 12:08 AM

Quote:

Originally Posted by sabret00the
you can do that in one query.

Would be nice if you could share how to ?

cinq 01-11-2005 07:09 AM

report comment, edit and delete comment done.
FCK's basic WSYIWYG integration works too, now working on the image upload handling in FCK. :D

sabret00the 01-11-2005 08:01 AM

something like this

PHP Code:

    if ($nextone)
    { 
// set the variables
            
$nextone $nextone['articles_articleid'];
            
$nextarticle 1;
        
$articlenav_direction ">";
        
$articlenav_order "ORDER BY articles_articleid ASC";
    }
    else if (
$previousone)
    {
        
$previousone $previousone['articles_articleid'];
        
$prearticle 1;
        
$articlenav_direction "<";
        
$articlenav_order "ORDER BY articles_articleid DECS";
    }

    
$articlenav $DB_site->query_first("SELECT articles_articleid FROM " TABLE_PREFIX "articles_article WHERE articles_articleid $articlenav_direction $artid AND categoryid = $categoryid $articlenav_order LIMIT 1"); 

far from impressive really, both acheive the same thing as well, theris really no reason to switch since it don't perform the query unless asked to.

cinq 01-11-2005 08:10 AM

I don't think your code does what I need it to do.
I need to query 2 times first to know if there are next or previous articles available.

In your code, if($nextone) or if($previousone) has no value initially...

cinq 01-11-2005 09:43 AM

Hmm FCK's default resource browser is really confusing. I have stripped away code to simplify it but not exactly giving the full functionality I would hope for.

ie. when adding an article, a folder for that article for its images is automagically created and when browsing should be only able to see this created folder.
However it now sees all folders. There is no way to pass the folder path to FCK to tell it to dynamically only show that particular folder.

It just means that you will have to manually search for the folder ( i will provide an folder number for you to search for ), click on it, to show all the images, or upload images there as well.

If this sounds about good, I consider this hack done and I will move on to the installation script. Please let me know.

sabret00the 01-11-2005 11:28 AM

Quote:

Originally Posted by cinq
I don't think your code does what I need it to do.
I need to query 2 times first to know if there are next or previous articles available.

In your code, if($nextone) or if($previousone) has no value initially...

the determination of the preview or next article before hand is impossible via my way you're right i apologise, however the $next and $preview comes from the url

i.e.
HTML Code:

<a href="http://localhost/forums/article.php?a=104845&nextone">next one</a>
the code would work but not for what you need it for without getting creative in the most awesome ways imaginable :lol: joking.

cinq 01-11-2005 02:14 PM

Hack has been released here

Thanks for all the help rendered everyone :D

sabret00the 01-15-2005 07:55 PM

Quote:

Originally Posted by sabret00the
wow, it is, i haven't ever rewritten the code i was giving along time ago for sorting pagenav but the code i have is 30 lines long :shock:

please share the knowledge :o

did the 3 line version of this never surface in this thread?

cinq 01-16-2005 12:44 PM

Unfortunately nope.
I would be interested to know too.

rake 01-16-2005 01:49 PM

Quote:

Originally Posted by cinq
Unfortunately nope.
I would be interested to know too.

This is the proper way to do pagination. It's from one of my scripts, and the original code is taken right out of vbulletin. All you need to edit are the two queries, the template that is called, and the fields you want to sort by.

PHP Code:

    // globalize variables
    
globalize($_REQUEST, array(
        
'pagenumber' => INT// pagenumber
        
'perpage' => INT// results per page
        
'sortfield' => STR// field by which to sort results
        
'sortorder' => STR// order in which to sort
    
));

    if (
$sortfield == '') {
        
$sortfield 'name';
    }

    if (
$sortorder == '') {
        
$sortorder 'asc';
    }



    switch (
$sortfield)
    {
        case 
'name':
            
$sqlsort 'name';
            break;
        case 
'id':
            
$sqlsort 'id';
            break;
        default:
            
$sqlsort 'name';
            
$sortfield 'name';
    }


    if (
$sortorder != 'asc')
    {
        
$sortorder 'desc';
        
$oppositesort 'asc';
    }
    else
    {
        
// $sortorder = 'ASC';
        
$oppositesort 'desc';
    }


    
$sorturl "$_SERVER[PHP_SELF]?$session[sessionurl]";


    eval(
'$sortarrow[' $sortfield '] = "' fetch_template('forumdisplay_sortarrow') . '";');



    
$dscount $DB_site->query_first("
        SELECT COUNT(*) AS count FROM site_garment
    "
);
    
$dscount $dscount['count'];

    
// set defaults
    
sanitize_pageresults($dscount$pagenumber$perpage10020);

    
$limitlower = ($pagenumber 1) * $perpage+1;
    
$limitupper = ($pagenumber) * $perpage;
    
$counter 0;

    if (
$limitupper $dscount)
    {
        
$limitupper $dscount;
        if (
$limitlower $dscount)
        {
            
$limitlower $dscount-$perpage;
        }
    }
    if (
$limitlower <= 0)
    {
        
$limitlower 1;
    }


    
$spheres $DB_site->query("SELECT * FROM site_garment ORDER BY $sqlsort $sortorder LIMIT ". ($limitlower-1) . ", $perpage");

    
$counter 0;
    
$resultbits '';
    while (
$grid $DB_site->fetch_array($spheres) AND $counter++ < $perpage)
    {

        
$grid[bonuses] = nl2br($grid[bonuses]);
        eval(
'$dresspheres .= "' fetch_template('site_ffx2_dsp_grid') . '";');



    }  
// end while
    
$pagenav construct_page_nav($dscount"$_SERVER[PHP_SELF]?$session[sessionurl]""&amp;pp=$perpage&order=$sortorder&amp;sort=$sortfield"); 


cinq 01-17-2005 11:52 AM

Thanks again Alex, appreciate it :)
I will try your code when time permits.


All times are GMT. The time now is 06:29 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01587 seconds
  • Memory Usage 1,882KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_html_printable
  • (8)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (35)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete