cms artikel naar een andere site schrijven

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Arno

arno

05/01/2008 20:20:00
Quote Anchor link
Hallo,

Ik ben bezig een cms aan het maken en het via een tutorial het een en ander gemaakt. Zo heb ik een mogelijkheid om artikelen te plaatsen, wijzigen of te verwijderen.
Nu is mijn vraag, hoe kan ik dit zo koppelen met een site. Ik heb een site in xhtml en css, dus vrij eenvoudig. Zou iemand mij hier mee kunnen helpen.
Het was de tutorial van http://www.php-mysql-tutorial.com/.
Het zijn een aantal codes dus weet ik niet of het handig is deze hier allemaa te plaatsen??
Alvast bedankt voor een reactie,

Vriendelijke groet,
Arno
Gewijzigd op 01/01/1970 01:00:00 door Arno
 
PHP hulp

PHP hulp

01/06/2024 14:04:05
 
Hipska BE

Hipska BE

05/01/2008 20:23:00
Quote Anchor link
wat bedoel je met "... koppelen met een site. ..." ???
 
Miniejjj

Miniejjj

05/01/2008 20:51:00
Quote Anchor link
In de layout zetten? Een divje gebruiken is denk ik wel de oplossing, misschien include?
 
Nicoow Unknown

Nicoow Unknown

05/01/2008 21:21:00
Quote Anchor link
ik snap niet precies wat je doet,
maar één mogelijkheid is om zo de links te doen:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
<?php
echo "<a href="index.php?page=tut1.php>tut1</a>";
echo "
<a href="index.php?page=tut2.php>tut2</a>";
echo "<a href="index.php?page=tut3.php>tut3</a>";
echo "
<a href="index.php?page=tut4.php>tut4</a>";
?>

en dan zo de div waarin je content staat:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
<?php
if(isset($_GET['page']))
{

    include $_GET['page'];
}

else
{
echo "standaard content";
}

?>

ik heb dit even extreem snel getypt, want het bier roept,
er zit hier nog geen beveiliging op.
 
Arno

arno

06/01/2008 11:55:00
Quote Anchor link
Hallo,
bedankt voor de reacties. Ik zal het even wat beter uitleggen.
Ik heb lokaal een website met daarin 4 kolommen, genaamd #div kolom1_sport, #div kolomsport2_sport etc.
Daarin wil ik via het cms teksten kunnen veranderen.

Ik heb nu een pagina waarin in teksten kan aanmaken en verwijderen en heb ik een link "opslaan", ik wil dat wanneer ik daar op klik dat de tekst in de kolom in de website is veranderd.

Het script van cms-admin.php is:


Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
include 'library/config.php';
include 'library/opendb.php';

if(isset($_GET['del']))
{

    // remove the article from the database
    $query = "DELETE FROM news WHERE id = '{$_GET['del']}'";
    mysql_query($query) or die('Error : ' . mysql_error());
    
    // then remove the cached file
    $cacheDir  = dirname(__FILE__) . '/cache/';
    $cacheFile = $cacheDir . '_' . $_GET['id'] . '.html';
    
    @
unlink($cacheFile);
    
    // and remove the index.html too because the file list
    // is changed

    @unlink($cacheDir . 'index.html');
    
    // redirect to current page so when the user refresh this page
    // after deleting an article we won't go back to this code block

    header('Location: ' . $_SERVER['PHP_SELF']);
    exit;
}

?>

<html>
<head>
<title>Admin Page For Content Management System (CMS)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
function delArticle(id, title)
{
    if (confirm("Are you sure you want to delete '" + title + "'"))
    {
        window.location.href = 'cms-admin.php?del=' + id;
    }
}
</script>
</head>

<body>
<?php
    $query
= "SELECT id, title FROM news ORDER BY id";
    $result = mysql_query($query) or die('Error : ' . mysql_error());
?>

<table width="600" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#999999">
 <tr align="center" bgcolor="#CCCCCC">
  <td width="500"><strong>Title</strong></td>
  <td width="150"><strong>Action</strong></td>
 </tr>
 <?php
    while(list($id, $title) = mysql_fetch_array($result, MYSQL_NUM))
    {

    
?>

 <tr bgcolor="#FFFFFF">
  <td width="500">
   <?php echo $title;?>
  </td>
  <td width="150" align="center"><a href="article2.php?id=<?php echo $id;?>" target="_blank">opslaan</a>
   | <a href="cms-edit.php?id=<?php echo $id;?>">edit</a> | <a href="javascript:delArticle('<?php echo $id;?>', '<?php echo $title;?>');">delete</a></td>
 </tr>
 <?php
    }
    
    include 'library/closedb.php';
?>

</table>
<p align="center"><a href="cms-add.php">Add an article</a></p>
</body>
</html>


In article2 komt de tekst in een vak te staan:

code article2.php is:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
include 'library/config.php';
include 'library/opendb.php';

if(isset($_GET['del']))
{

    // remove the article from the database
    $query = "DELETE FROM news WHERE id = '{$_GET['del']}'";
    mysql_query($query) or die('Error : ' . mysql_error());
    
    // then remove the cached file
    $cacheDir  = dirname(__FILE__) . '/cache/';
    $cacheFile = $cacheDir . '_' . $_GET['id'] . '.html';
    
    @
unlink($cacheFile);
    
    // and remove the index.html too because the file list
    // is changed

    @unlink($cacheDir . 'index.html');
    
    // redirect to current page so when the user refresh this page
    // after deleting an article we won't go back to this code block

    header('Location: ' . $_SERVER['PHP_SELF']);
    exit;
}

?>

<html>
<head>
<title>Admin Page For Content Management System (CMS)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
function delArticle(id, title)
{
    if (confirm("Are you sure you want to delete '" + title + "'"))
    {
        window.location.href = 'cms-admin.php?del=' + id;
    }
}
</script>
</head>

<body>
<?php
    $query
= "SELECT id, title FROM news ORDER BY id";
    $result = mysql_query($query) or die('Error : ' . mysql_error());
?>

<table width="600" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#999999">
 <tr align="center" bgcolor="#CCCCCC">
  <td width="500"><strong>Title</strong></td>
  <td width="150"><strong>Action</strong></td>
 </tr>
 <?php
    while(list($id, $title) = mysql_fetch_array($result, MYSQL_NUM))
    {

    
?>

 <tr bgcolor="#FFFFFF">
  <td width="500">
   <?php echo $title;?>
  </td>
  <td width="150" align="center"><a href="article2.php?id=<?php echo $id;?>" target="_blank">view</a>
   | <a href="cms-edit.php?id=<?php echo $id;?>">edit</a> | <a href="javascript:delArticle('<?php echo $id;?>', '<?php echo $title;?>');">delete</a></td>
 </tr>
 <?php
    }
    
    include 'library/closedb.php';
?>

</table>
<p align="center"><a href="cms-add.php">Add an article</a></p>
</body>
</html>



De lokale website met daarin de voorgenoemde div'jes staat in het document: C:\Program Files\EasyPHP1-8\www\web\intro3.html.

Ik denk zelf dat ik verwijzingen moet maken in cms-admin alleen ik weet dus niet hoe, ik hoop dat iemand mij kan helpen.

ps. Ben een beginner

Alvast bedankt,

Vriendelijke groeten,
Arno
Gewijzigd op 01/01/1970 01:00:00 door arno
 
Vincent

Vincent

06/01/2008 11:59:00
Quote Anchor link
zet is aan het begin van je code en aan het eind van je code ;-)
 
Jurgen assaasas

Jurgen assaasas

06/01/2008 12:15:00
Quote Anchor link
waarom elke keer php openen voor 1 echo en weer sluiten?
 
Arno

arno

06/01/2008 12:35:00
Quote Anchor link
Ik heb dit aan de hand van een tutorial gedaan en heb ht overgetypt om zo een beetje te snappen , wat, waar gebeurd.
 
Arno

arno

26/02/2008 13:55:00
Quote Anchor link
is er iemand die mij hiermee kan helpen??,
Ik ben er nog steeds niet uit, hoe ik de tekst die ik aanmaak in het cms kan verwerken binnen de website??
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.